4

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!

1
  • 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, 2013 at 16:20

4 Answers 4

3

You can pipe the password to encfs like this:

echo password | encfs -S /crypted /uncrypted
2
  • You should use encfs's extpass option instead. Mar 8, 2018 at 10:26
  • why? according to the man page the -S param is made exactly for this. of course the password will be plain text in your script
    – D-rk
    Oct 22, 2019 at 17:59
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .