I was searching for a solution to mount an encrypted folder on my synology nas via terminal and found out that DSM uses ecryptfs. Using mount.ecryptfs $ENCRYPT_DIR_PATH $MOUNTED_DIR_PATH
actually works but the mounted directory with decrypted data doesn't show in the samba shares or in the web GUI. Further i found out that synology made a program/script to solve this. synoshare --enc_mount $ENCRYPT_DIR_PATH $PASSWORD
should mount the folder and make it visible but sadly it crashes.
Error SYNOShareEncShareMount() failed.[0x1400 share_db_get.c:31]
Does anyone know what the problem is here?
SECURITY WARNING:
Someone who searches a way to do this might stumble upon this thread, so i want to warn you about something i read here. If you use synoshare --enc_mount $ENCRYPT_DIR_PATH $PASSWORD
your password will be in plain text on the terminal and also in /var/log/bash_history.log
which is obviously a security flaw. If you scroll down on the linked page you find a post from user fairlane in which he wrote a small script to use synoshare
without revealing the password. For the sake of completeness i post it here.
echo -n "Enter Share Password: "
read -s passwordVariable
echo ""
/usr/syno/sbin/synoshare --enc_mount $1 $passwordVariable
auth.log
entry by making sudo run bash and providing the command on stdin, eg:sudo bash <<<"synoshare --enc_mount $DIR $PW"
(note<<<
in bash means provide the string on stdin).sudo
. So you possibly only need the<<<
trick if you're literally runningsudo synoshare ...
. If you're runningsudo myscript
andmyscript
callssynoshare ...
, it's probably fine.