(1)安装
[root@ECS iclound]# wget https://launchpad.net/ecryptfs/trunk/111/+download/ecryptfs-utils_111.orig.tar.gz
[root@ECS iclound]# tar zxvf ecryptfs-utils_111.orig.tar.gz
[root@ECS ecryptfs-utils-111]# ./configure --prefix=/usr/local/ecryptfs
[root@ECS ecryptfs-utils-111]# make
[root@ECS ecryptfs-utils-111]# make install
(2)创建目录
[root@ECS]#mkdir -pv /data //真实目录
[root@ECS]#mkdir -pv /iclound //挂载目录
(3)使用ecryptfs初始化目录
[root@ECS]#mount -t ecryptfs /data /iclound
Passphrase:
Select cipher:
1) aes: blocksize = 16; min keysize = 16; max keysize = 32
2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56
3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24
4) twofish: blocksize = 16; min keysize = 16; max keysize = 32
5) cast6: blocksize = 16; min keysize = 16; max keysize = 32
6) cast5: blocksize = 8; min keysize = 5; max keysize = 16
Selection [aes]:
Select key bytes:
1) 16
2) 32
3) 24
Selection [16]: 32
Enable plaintext passthrough (y/n) [n]:
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [048b231563eb2ad0]:
Attempting to mount with the following options:
ecryptfs_unlink_sigs
ecryptfs_fnek_sig=048b231563eb2ad0
ecryptfs_key_bytes=32
ecryptfs_cipher=aes
ecryptfs_sig=048b231563eb2ad0
Mounted eCryptfs
(4)测试
上传测试文件
[root@ECS]# ls -l
-rw-r--r-- 1 root root 49085020 Nov 14 2017 思科《BGP设计与实现》.pdf
-rw-r--r-- 1 root root 32611945 Nov 14 2017 思科《网络安全性设计(第二版)》.pdf
-rw-r--r-- 1 root root 25114337 Nov 2 2017 思科《高级MPLS设计与实施》.pdf
-rw-r--r-- 1 root root 2109379 Mar 19 2018 红茶三杯BGP.pdf
-rw-r--r-- 1 root root 2944231 Mar 19 2018 红茶三杯IProuting.pdf
-rw-r--r-- 1 root root 2228116 Mar 19 2018 红茶三杯IPv6.pdf
-rw-r--r-- 1 root root 1675721 Mar 19 2018 红茶三杯MPLS.pdf
-rw-r--r-- 1 root root 2485151 Mar 19 2018 红茶三杯MPLSTE.pdf
-rw-r--r-- 1 root root 5276538 Mar 19 2018 红茶三杯MPLSVPN.pdf
-rw-r--r-- 1 root root 1834720 Mar 19 2018 红茶三杯OSPF.pdf
-rw-r--r-- 1 root root 2811654 Mar 19 2018 红茶三杯Switching.pdf
卸载挂载目录
[root@ECS]#umount /iclound
查看加密目录
[root@ECS]# ls -l
total 281136
-rw-r--r-- 1 root root 2822144 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojj4b5uZtdfAASWROMrSKu1dYvuBvODnW8kswp5.6DgfH2-
-rw-r--r-- 1 root root 2953216 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojj4b5uZtdfAASWROMrSKu1dcUDczSbM-WqQCuMj-XlXCU-
-rw-r--r-- 1 root root 2236416 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojj8WKFoOWx3b7MDQbco9Zn-ZXSSJePKzUBt34rK68ohto-
-rw-r--r-- 1 root root 1843200 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojj8WKFoOWx3b7MDQbco9Zn-e0zcVLKZHKpwzXjtbKJcqY-
-rw-r--r-- 1 root root 1687552 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojj8WKFoOWx3b7MDQbco9Zn-jfsSFHWNHxP3tMmuIi899w-
-rw-r--r-- 1 root root 5287936 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojjK30hBKmgcUD3Z58xyq-YFoGAjtYn4FOMaO6OzSbx5h2-
-rw-r--r-- 1 root root 2117632 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojjTId.ryt0v0Lpx5jPNx-M29MPUOHSL8Y61Or18XPpmVM-
-rw-r--r-- 1 root root 2494464 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojjfa8BsuHd-EtzGyd0CMz6mGm4yKAm1mboJRhDoU-RjSI-
-rw-r--r-- 1 root root 2494464 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYDN8vcm6G1zHEAopbl8Ef15haMtzMicskNMIznSiDFCU-
-rw-r--r-- 1 root root 2953216 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYUKKNbHUe3ixo0BHAZx0upZ.hW7xZ9InVWjShKdmWfzY-
-rw-r--r-- 1 root root 2822144 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYUKKNbHUe3ixo0BHAZx0upZgAD5cBM6KtXCzTUcCSvyM-
-rw-r--r-- 1 root root 5287936 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYfqkOfzHA.PY1fyHfeexeAVJdaHzU-OSNKJ4ucisWOfY-
-rw-r--r-- 1 root root 1843200 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYvA6.qJ6XPdqYgjqeu2rys42.JCQkdvTcQNDfQaGIVE--
-rw-r--r-- 1 root root 2236416 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYvA6.qJ6XPdqYgjqeu2rys5YFK6Jc4VDBbOEAcxuOsA--
-rw-r--r-- 1 root root 1687552 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYvA6.qJ6XPdqYgjqeu2rysDxh33jT3CKV.5sTo.X.fXQ-
-rw-r--r-- 1 root root 2117632 Mar 19 2018 ECRYPTFS_FNEK_ENCRYPTED.FXY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYy-WhpglOyqyt0YRXEySFN8l60EhexRBuS.Gm7mx.4sc-
-rw-r--r-- 1 root root 15572992 Nov 2 2017 ECRYPTFS_FNEK_ENCRYPTED.FYY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojjDx-E304294o0uITpWFBOnrXddINc4qKvGPIH.ACTZUDQJbFv3ApxchEUpb7xaTD9
-rw-r--r-- 1 root root 49094656 Nov 14 2017 ECRYPTFS_FNEK_ENCRYPTED.FYY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojjMc93GPummUvYhtAVddSXI8xzqwAFt40Qp0xXlnDd8uUOfYfllc2jj7ClpmLhcJYA
-rw-r--r-- 1 root root 25124864 Nov 2 2017 ECRYPTFS_FNEK_ENCRYPTED.FYY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojjSVYfd1xkdNweRx3Zvex41ql3QrPbwLXncjM0hnV3vRZv78bbh533Oas37m.m7OLX
-rw-r--r-- 1 root root 25124864 Nov 2 2017 ECRYPTFS_FNEK_ENCRYPTED.FYY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYIhzUEQQB8D20wB-y.4VNLhizE27wBQw-H5IeBjXk5F97LZoCKwt0nowZQt605FR6
-rw-r--r-- 1 root root 49094656 Nov 14 2017 ECRYPTFS_FNEK_ENCRYPTED.FYY2WmAJMygeo-ak2C7IpJLHpdZSqnV-5ylYd8yBkkIOmaH8oX0HIHmLGc77uJfKtcTWKTlDakTmTCTq8ty-B2KoU7XxGJMECoru
-rw-r--r-- 1 root root 32620544 Nov 14 2017 ECRYPTFS_FNEK_ENCRYPTED.FZY2WmAJMygeo-Q-KoqU3Jl7TwGGOiEnrojj.2N17GkDXCdtWS3bHy1Vw2DYaD67EsGuE5.OMvwz-tWTIu3SgpGS6LBzg3TBLAbjSShr1OmDe0rc2RLCzTb0yE--
挂载目录
[root@ECS]#mount -t ecryptfs /data /iclound