Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make a script, that creates and mounts encrypted directory using ecryptfs(on ssh logons(with passphrase sent via pipe) and by some other scripts). I know about ecryptfs-setup-private already.

What I'm trying to do:


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

echo "passphrase_passwd=zxc" > ecryptfs_passphrase_passwd


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

And it fails for some reason with following output:

# ./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

# tail /var/log/syslog
Apr 27 19:28:23 debian mount.ecryptfs: Error initializing key module [/usr/lib/ecryptfs/];
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]

What am I doing wrong?

share|improve this question
up vote 0 down vote accepted

What version of eCryptfs are you using?

I believe we released a fix to this bug in 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   

See bug #683535.

Full disclosure: I'm one of the authors and maintainers of eCryptfs.

share|improve this answer
Debian packages libecryptfs0 and ecrypt-utils version is 83-4+squeeze1, which is less than 94. That's probably it. – scriptaholic Apr 29 '12 at 4:30
Having the same problem. How did you get the latest version installed on debian then? Also, I'm wondering why when I use something like mount ... passphrase_passwd=`echo $PASSWORD` (which should be reasonably secure considering $PASSWORD is only defined temporarily) - when I run mount from any (non-root) user account I can see the passphrase in plain text... – Yoav Aner Jun 24 '12 at 8:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.