Article
encfs加密文件系统
为了数据安全,最近领导给了个链接让去了解了解 eCryptfs 。通过yum和自己手动编译安装后都运行失败,系统的Centos7内核不支持ecryptfs模块 。
通过一个介绍ecryptfs的关联的链接 了解到 encfs 也是做 ecryptfs 类似的事情。然后就去下载安装,最后发现windows下面也可以用(惊喜)。
epel下面已经发布了 encfs 的rpm包。现在只要是仓库有的包就不自己编译(进行过N次升级的洗礼,最终发现yum、rpm才是最终归宿啊)。
[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
注意: 最好将 .encfs6.xml 备份起來, 这个文件损坏或丢失将无法还原加密的文件。
把加密的文件备份到云盘,然后本地挂载就能看到原始内容了。安全的云盘就这么简单的实现了,咔咔。。。
在windows安装 EncFSMP 就可以和在Linux上面一样操作encfs文件系统了。
EncFS从原理不同TrueCrypt的容器 ,它存储在一个单一的大文件的加密文件。 相反,EncFS为您添加的每个文件创建单独的文件。 它更好地与云存储服务,每次更改时重新上传整个TrueCrypt容器。
# 参考链接
-
https://linux.cn/article-4470-1.html 通过这篇文章查看到了encfs
-
http://www.vonwei.com/post/introduceToEncFS.html 中文简单介绍和入门。手动编译,命令的参数也有介绍,还有介绍加密目录的 .encfs6.xml
-
https://github.com/vgough/encfs/blob/master/encfs/encfs.pod#examples
-
https://github.com/vgough/encfs/blob/master/encfs/encfsctl.pod
-
https://www.howtoip.com/how-to-encrypt-cloud-storage-on-linux-and-windows-with-encfs/ 非常棒的教程,linux和windows都介绍了
-
http://www.jianshu.com/p/073957902fa9 手动编译,以后可能用得到。最后的启动自动加载磁盘可以借鉴。
-
https://github.com/vgough/encfs/issues/66 encfs on cygwin
-
https://superuser.com/questions/179150/reading-an-encfs-volume-from-windows
-
https://encfsmp.sourceforge.io/download.html for windows
-
https://github.com/dokan-dev/dokany fuse on windows
–END
Related
Related posts
-
在树莓派 Ubuntu Server 上跑 OpenClaw Browser:Chromium 无头模式实战
2026-03-08
-
Linux brew安装过程
2026-02-01
-
本地端口转发:访问远程 Linux 本地服务
2026-02-01
-
Fabric:命令行管道中的 AI 工具,更具价值的是里面 230 个系统提示词
2026-01-08