Cron using a command that asks for password
I am using an encrypted amazon cloud drive as a source drive for using the same files on many different machines. I have it mounted on several Ubuntu machine and everything works fine, but in order to update the local cache it needs to be unmounted.
These machines only read from the cloud, the source material is uploaded via another machine. I need some help making a cron task or script that will run every hour and first unmount the encrypted fs, update the local cache, remount the cloud and remount the encfs on top. When I use encfs from the command line, I use a xml encryption file and then it prompts for the master password. Quote:
Code:
/bin/fusermount -u /home/user/.cloud Code:
/usr/local/bin/acd_cli s Code:
/usr/local/bin/acd_cliacd_cli mount --modules="subdir,subdir=/Ww4hiiFIGcL50MEsUcd2NI4e" /home/user/.cloud Code:
ENCFS6_CONFIG='/home/user/1.Important.files/.encfs6.xml' encfs /home/user/.cloud /home/user/cloud Hopefully someone will be able to help me with this. Thanks in advance. |
What have you done so far?
Did you check the man pages and documentation for encfs?
Since it can be set to automount on boot, there must be a way for it to pick up the password without prompting. If you do not find that way, may I suggest the use of something like 'expect' to provide that capability. Be aware that if you provide the password in an expect script, or in some config file, it does make the entire operation a little less secure. (since it will add either unencrypted passwords in a file, or an additional encrypted copy that may be vulnerable to detection and decryption). |
I have checked the man pages and didn't see anything about the auto mount using config files.
On closer inspection, I found the following option; Quote:
Code:
cat /home/user/.password | ENCFS6_CONFIG='/home/user/1.Important.files/.encfs6.xml' encfs -S /home/user/.cloud /home/user/cloud |
from the encfs man page (http://linux.die.net/man/1/encfs):
-S, --stdinpass Read password from standard input, without prompting. This may be useful for scripting encfs mounts. If you don't have this option, your version my be too old. |
Using the -S option works.
It's a little bit unsecured because I have the password in plaintext in a file, but I will do my best to hide it and continue looking for a safer alternative. But right now, it does what I wanted it to do. Thanks for the interest and help. |
All times are GMT -5. The time now is 09:33 PM. |