Linuxで暗号化FS
Submitted by nasuno on 2007, May 29 - 4:11pm.
"mode" オプションについては、とりあえずそのまま Enter して、standard を選択します。
パスフレーズを設定して作成が完了したら、暗号化FSがマウントされていることを確認してみましょう。
アンマウントは以下のようにします。
Tagged: linux
CentOSにEncFSを導入し、Linux上で暗号化ファイルシステム環境をお手軽に構築する方法をまとめてみました。
Windows 環境ならば TrueCrypt が断然便利で強力な暗号化ツールだと思いますが、EncFSは、あらかじめファイルシステムのサイズを決めておく必要がないという点では管理が楽です。
依存するソフトウェアのインストール
CentOS用のRPMが存在するものについては、(お手軽に) yum を利用しました。
- C++ compiler
-
shell> yum install -y gcc-c++
- OpenSSL libraries and include files
-
shell> yum install -y openssl-devel
- kernel headers
-
shell> yum install -y kernel-devel
- RLog
-
http://freshmeat.net/redir/rlog/47815/url_tgz/rlog-1.3.7.tgz
shell> ./configure shell> make shell> sudo make install
- Filesystem in Userspace
-
http://freshmeat.net/redir/fuse/54432/url_tgz/fuse-2.6.5.tar.gz
shell> ./configure shell> make shell> sudo make install
EncFSのインストール
-
http://freshmeat.net/projects/encfs/
http://freshmeat.net/redir/encfs/45687/url_tgz/encfs-1.3.2-1.tgzshell> ./configure shell> make shell> sudo make install
使い方
まず暗号化ファイルを格納するディレクトリとそのマウント先を指定して、暗号化FSを新規に作成します。
shell> encfs ~/.crypt-raw ~/crypt The directory "/home/nasuno/.crypt-raw/" does not exist. Should it be created? (y,n) y The directory "/home/nasuno/crypt" does not exist. Should it be created? (y,n) y Creating new encrypted volume. Please choose from one of the following options: enter "x" for expert configuration mode, enter "p" for pre-configured paranoia mode, anything else, or an empty line will select standard mode. ?>
パスフレーズを設定して作成が完了したら、暗号化FSがマウントされていることを確認してみましょう。
shell> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6.7G 2.0G 4.3G 32% /
/dev/sda1 99M 16M 78M 17% /boot
tmpfs 252M 0 252M 0% /dev/shm
encfs 6.7G 2.0G 4.3G 32% /home/nasuno/crypt
shell> mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
encfs on /home/nasuno/crypt type fuse (rw,nosuid,nodev,default_permissions,user=nasuno)
shell> fusermount -u ~/crypt
補足
一般ユーザ権限でマウントした暗号化ディレクトリに対しては、他のユーザはもちろんのことrootでさえも一切アクセスできません。
ファイル/ディレクトリ名とファイルの内容が暗号化されているとはいえ、それらが置かれている通常のディレクトリを見れば、ファイルの数やサイズを確認することは可能です。用心深く神経質なユーザにはちょっと気になるかもしれません。
FedoraCoreやDebianだとEncFSのパッケージが用意されているようなので、導入は非常に簡単ですね。。。