[root@k8s ~]# yum install fuse
[root@k8s ~]# yum install encfs
挂载、创建
[root@k8s shm]# encfs /dev/shm/.test /dev/shm/test
The directory "/dev/shm/.test/" does not exist. Should it be created? (y,n) y
The directory "/dev/shm/test/" 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.
?>
Standard configuration selected.
Configuration finished. The filesystem to be created has
the following properties:
Filesystem cipher: "ssl/aes", version 3:0:2
Filename encoding: "nameio/block", version 4:0:2
Key Size: 192 bits
Block Size: 1024 bytes
Each file contains 8 byte header with unique IV data.
Filenames encoded using IV chaining mode.
File holes passed through to ciphertext.
Now you will need to enter a password for your filesystem.
You will need to remember this password, as there is absolutely
no recovery mechanism. However, the password can be changed
later using encfsctl.
New Encfs Password: 123456
Verify Encfs Password:
[root@k8s shm]# echo $(hostname) > test/hostname.txt
[root@k8s shm]# ll -R -a
.:
total 0
drwxrwxrwt. 4 root root 80 Aug 4 22:04 .
drwxr-xr-x. 20 root root 3260 Aug 4 21:16 ..
drwx------. 2 root root 80 Aug 4 22:06 test
drwx------. 2 root root 80 Aug 4 22:06 .test
./test:
total 4
drwx------. 2 root root 80 Aug 4 22:06 .
drwxrwxrwt. 4 root root 80 Aug 4 22:04 ..
-rw-r--r--. 1 root root 4 Aug 4 22:06 hostname.txt
./.test:
total 8
drwx------. 2 root root 80 Aug 4 22:06 .
drwxrwxrwt. 4 root root 80 Aug 4 22:04 ..
-rw-r--r--. 1 root root 1263 Aug 4 22:04 .encfs6.xml
-rw-r--r--. 1 root root 12 Aug 4 22:06 pAqhW671kQSK4kPLJM-TF6sp
卸载
[root@k8s shm]# fusermount -u test
[root@k8s shm]# ll -R -a
.:
total 0
drwxrwxrwt. 4 root root 80 Aug 4 22:04 .
drwxr-xr-x. 20 root root 3260 Aug 4 21:16 ..
drwx------. 2 root root 40 Aug 4 22:04 test
drwx------. 2 root root 80 Aug 4 22:06 .test
./test:
total 0
drwx------. 2 root root 40 Aug 4 22:04 .
drwxrwxrwt. 4 root root 80 Aug 4 22:04 ..
./.test:
total 8
drwx------. 2 root root 80 Aug 4 22:06 .
drwxrwxrwt. 4 root root 80 Aug 4 22:04 ..
-rw-r--r--. 1 root root 1263 Aug 4 22:04 .encfs6.xml
-rw-r--r--. 1 root root 12 Aug 4 22:06 pAqhW671kQSK4kPLJM-TF6sp