0

I would like to decrypt an EncFS "volume" on startup. Usually I decrypt the volume like this :

cat "/home/user1/encfs.pw" | encfs -S /mnt/encryptedVolume /mnt/decryptedVolume

In /etc/init I have a myService.conf file :

start on startup
stop on shutdown
respawn

pre-start script
  cat "/home/user1/encfs.pw" | encfs -S /mnt/encryptedVolume /mnt/decryptedVolume
end script

exec /home/user1/myService

Without the pre-start section, myService starts okay. With the pre-start section, it doesn't because as stated in documentation, if the script lines fail it exists.

My issue is that the script line works in a shell but not in this pre-start.

Can someone please help ? Thank you for your assistance.

3
  • Is /mnt/encryptedVolume already mounted when the pre-start script runs? And I hope /home/user1/encfs.pw is on another encrypted partition, or at least a removable drive you keep somewhere safe, otherwise it's in plain sight for anyone who gets access to your computer, right?
    – Xen2050
    Dec 27, 2015 at 11:16
  • Try starting the service from a terminal: initctl start myService. What's the output? Are there any error messages? Dec 27, 2015 at 15:59
  • Hi, Thanks your feedback. You are right /mnt/encryptedVolume was not mounted yet (fstab). I just added sleep 20 before the encfs call and it works !
    – chris3389
    Dec 27, 2015 at 17:10

1 Answer 1

0

(I guess my comment should be an answer...)

I'm guessing "/mnt/encryptedVolume" is not mounted yet when the startup script is being run.

You could wait for a while to run the script until after the needed volume is mounted,

  • using a sleep 20 in the script.
  • Or run the script after everything's "up" and mounted and you're logged in, running initctl start myService should work.

You must log in to answer this question.

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