Can I decrypt an ecryptfs Private directory from a script?
My basic use case for this type of activity is for doing remote backups. Imagine you have a machine (call it privatebox) with an encrypted private directory that stores your photos (or some other sensitive information). It is only decrypted upon logging in. And imagine that you want to be able to write a script on a remote machine that will log into the privatebox, decrypt the directory to add a photo, then re-encrypt it and log out. All without user interactive steps being required (maybe it runs from cron). Note that the passphrase for the privatebox would NOT be stored on the privatebox in plain text or anything. And since it would be encrypted (except during the update) it would be protected if someone obtained the SD card, etc.
Such a script would work like this (in my mind):
- setup private directory on privatebox that is encrypted with a passphrase
- setup ssh keys from local machine to privatebox so you can use ssh non-interactively (cron can login)
- Then what? How do you decrypt a private folder non-interactively if you know the passphrase?
It seems that ecryptfs is specifically designed to not allow this (even with SSH key trickery, you still have to manually mount your private directory).
Basically, what I'm looking for is a non-interactive version of 'ecryptfs-mount-private' or something similar if anyone knows a solution. Something like:
% ecryptfs-mount-private -p $PASSPHRASE
Where I could pass the passphrase instead of having to type it.
If ecryptfs can't do this, does anyone know of an alternative? Thanks!
man ecryptfs
,man mount.ecryptfs
andman mount.ecryptfs_private
?