ecryptfs加密文件夹

1 加密

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ecryptfs-setup-private --nopwcheck --noautoumount
ecryptfs-setup-private --nopwcheck --noautoumount
ecryptfs-setup-private --nopwcheck --noautoumount

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

2 挂载

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ecryptfs-mount-private
ecryptfs-mount-private
ecryptfs-mount-private

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

3 脚本自动挂载

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/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
#!/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
#!/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 *