Linux

encryptfs 自動掛載腳本

  • April 27, 2012

我正在嘗試製作一個腳本,該腳本使用 ecryptfs(在 ssh 登錄(通過管道發送密碼)和其他一些腳本)創建和掛載加密目錄。我已經知道 ecryptfs-setup-private 了。

我正在嘗試做的事情:

#!/bin/bash

mkdir 1 &> /dev/null
mkdir 2 &> /dev/null

echo "passphrase_passwd=zxc" > ecryptfs_passphrase_passwd

OPTS="ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_enable_filename_crypto=y,ecryptfs_fnek_sig=7513645981364589,ecryptfs_passthrough=n"

cat ecryptfs_passphrase_passwd | \
mount -t ecryptfs -o ${OPTS},key=passphrase:passphrase_passwd_fd=0 1 2

並且由於某種原因失敗,輸出如下:

# ./mountit              
Error attempting to evaluate mount options: [-22] Invalid argument
Check your system logs for details on why this happened.
Try updating your ecryptfs-utils package, and/or
submit a bug report on https://launchpad.net/ecryptfs

# tail /var/log/syslog
...
Apr 27 19:28:23 debian mount.ecryptfs: Error initializing key module [/usr/lib/ecryptfs/libecryptfs_key_mod_gpg.so];
Apr 27 19:28:23 debian mount.ecryptfs: parse_options_file: mmap failed on fd [0]; rc = [-22]
Apr 27 19:28:23 debian mount.ecryptfs: tf_pass_file: Error parsing file for passwd; rc = [-22]

我究竟做錯了什麼?

您使用的是什麼版本的 eCryptfs?

我相信我們在ecryptfs-utils-94中發布了對這個錯誤的修復:

 * src/libecryptfs/cmd_ln_parser.c: LP: #683535
   - fix passphrase_passwd_fd for pipes        
   - handle memory allocation failures         
   - free memory in error paths   

請參閱錯誤 #683535

全面披露:我是 eCryptfs 的作者和維護者之一。

引用自:https://serverfault.com/questions/383709