Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

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

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 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]

What am I doing wrong?

share|improve this question
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.