Mount EncFS at boot

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?

Thanks!


Solution 1:

You can pipe the password to encfs like this:

echo password | encfs -S /crypted /uncrypted

Solution 2:

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

#!/bin/bash
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.