2

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!

  • 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
2

You can pipe the password to encfs like this:

echo password | encfs -S /crypted /uncrypted
  • You should use encfs's extpass option instead. – Matthias Urlichs Mar 8 '18 at 10:26
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.

1

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

/usr/local/sbin/mount_crypted_encfs.exp

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 :-/

0

I use the SD Card as key, to open the encfs folder but you can use file specific for your system.

encfs /home/user/crypted /home/user/uncrypted -o umask='007' --public  --extpass='udevadm info --query=all --name=/dev/mmcblk0p1 | grep ID_SERIAL'

Put this in your rc.local, or run it as the service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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