Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

am trying to get an EncFS encrypted home to mount at boot without user input (directly, not via ssh). Have tried various solutions (adding a volume entry in pam_mount.conf.xml, various tweaks to various pam files) with no joy. Can mount the encfs directory just fine manually, but requires manual entry of password. Can accomplish all of this with an expect script...

There are a number of posts on automounting encfs at boot, but can't get any of them to work (short of the expect script).

Can anyone suggest how to do this (am using Debian Squeeze)? Or is an expect script the best way to go?


share|improve this question
Anyone? If we changed what we are asking to get encfs to mount at login, we are asked a 2nd time for the password. Again, have tried various posts that suggest tweaks to things like /etc/pam.d/common-auth with no success. If we want to encfs to mount automatically at login, any suggestions and avoid 2nd request for pw? Thanks! – senrabdet Jan 21 '13 at 16:20

You can pipe the password to encfs like this:

echo password | encfs -S /crypted /uncrypted
share|improve this answer

Also on Squeeze, I use this line in /etc/rc.local:


And the script is:

#!/usr/bin/expect -f

set timeout 1

spawn /usr/bin/encfs /crypted /uncrypted -- -o allow_other -o default_permissions
expect "EncFS Password:"
send "myPassword\r" 

expect eof

But one out of ten times, it fails mounting and I have to run the expect script manually :-/

share|improve this answer

I simply use a bash script like this one-liner:

ENCFS6_CONFIG="/home/<user>/.keys/encfs/key_data.xml" encfs -o nonempty --extpass='/home/<user>/.keys/encfs/key_data_pw' /run/media/<user>/data /home/<user>/DATA

The use of ENCFS_CONFIG and extpass is well documented in the EncFS docs.

share|improve this answer

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.