Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2811

ディレクトリを暗号化する(eCryptfs)

$
0
0

暗号化ディレクトリを作成する

# ecryptfs-utilsパッケージをインストールするsudo apt install ecryptfs-utils
[sudo]****のパスワード: ******パッケージリストを読み込んでいます... 0%

パッケージリストを読み込んでいます... 100%

(略)

# 暗号化ディレクトリの作成
ecryptfs-setup-private
# ****はユーザー名 Privateディレクトリが作成される(.Privateも)ls /home/****
Private ダウンロード テンプレート デスクトップ ドキュメント ビデオ ピクチャ ミュージック 公開
# 作成時はまだマウントされていないdf
Filesystem     1K-blocks    Used Available Use% Mounted on
udev             1762436       0   1762436   0% /dev
tmpfs             357264    1556    355708   1% /run
/dev/sda1       10253588 7288988   2424032  76% /
(略)
# マウントする
ecryptfs-mount-private
Enter your login passphrase:*****# /home/****/.Privateディレクトリが/home/****/Privateにマウントされるdf | less
Filesystem           1K-blocks    Used Available Use% Mounted on
udev                   1762436       0   1762436   0% /dev
tmpfs                   357264    1552    355712   1% /run
/dev/sda1             10253588 7288992   2424028  76% /
(略)
/home/****/.Private  10253588 7288992   2424028  76% /home/****/Private

再起動時には自動マウントされる為には2つの条件を満たす必要

  1. auto-mount, auto-umountが存在する(ディレクトリ作成時に ~/.ecryptfsディレクトリに作成されている))
  2. /etc/pam.dディレクトリにある設定ファイルにpam_ecryptfs.soモジュールが指定されている

(ただし、この2つの条件は暗号化ディレクトリ作成時にデフォルトで満たされている)

# 1の条件を確認ls /home/****/.ecryptfs
Private.mnt  Private.sig  auto-mount  auto-umount  wrapped-passphrase
# 2の条件を確認ls /etc/pam.d
chfn             common-session-noninteractive  login     runuser-l
chpasswd         cron                           newusers  samba
chsh             cups                           other     sshd
common-account   gdm-autologin                  passwd    su
common-auth      gdm-fingerprint                polkit-1  sudo
common-password  gdm-launch-environment         ppp       systemd-user
common-session   gdm-password                   runuser

cat /etc/pam.d/common-auth
## /etc/pam.d/common-auth - authentication settings common to all services(略)

# here are the per-package modules (the "Primary" block)
auth    [success=1 default=ignore]  pam_unix.so nullok_secure
# here's the fallback if no module succeeds
auth    requisite           pam_deny.so
# prime the stack with a positive return value if there isn't one already;# this avoids us returning an error just because nothing sets a success code# since the modules above will each just jump around
auth    required            pam_permit.so
# and here are more per-package modules (the "Additional" block)
auth    optional    pam_ecryptfs.so unwrap
auth    optional            pam_cap.so 
# end of pam-auth-update config

Viewing all articles
Browse latest Browse all 2811

Trending Articles