我正在尝试编写一个脚本,使用 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]
我究竟做错了什么?
答案1
您使用哪个版本的 eCryptfs?
我相信我们发布了一个修复这个错误的版本ecryptfs-实用程序-94:
* src/libecryptfs/cmd_ln_parser.c: LP: #683535
- fix passphrase_passwd_fd for pipes
- handle memory allocation failures
- free memory in error paths
完全披露:我是 eCryptfs 的作者和维护者之一。