ecryptfs加密文件夹

1 加密

ecryptfs-setup-private --nopwcheck --noautoumount

两个参数是不校验登录密码(用mount密码)、不自动卸载 (但是参数似乎不好用)

2 挂载

ecryptfs-mount-private

输入mount密码可挂载到~/Private下

3 脚本自动挂载

网上搜到的都是keyring,不好使,这里直接用了expect

#!/bin/bash
 
/usr/bin/expect > /dev/null <<EOF
    set timeout -1
    spawn ecryptfs-mount-private
     
    expect {
        "Enter your login passphrase:" {
            send "password\r"
        }
    }
     
    expect eof
EOF

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *