Mount encrypted filesystems
From Notes_Wiki
<yambe:breadcrumb>Useful_bash_shell_scripts|Useful bash shell scripts</yambe:breadcrumb>
Mount encryped filesystems
Following script can be used for mounting many different encrypted filesystems that use same password:
#!/bin/bash read -s -p "Password: " PASSWORD sshpass -p "$PASSWORD" sudo encfs --public /mnt/data1/raw_folders/documents_raw /documents sshpass -p "$PASSWORD" sudo encfs --public /mnt/data1/raw_folders/personal_raw /mnt/personal sshpass -p "$PASSWORD" sudo encfs --public /var/lib/mysql_raw /var/lib/mysql sudo /sbin/service mysqld start sshpass -p "$PASSWORD" sudo encfs --public /var/lib/pgsql_raw /var/lib/pgsql sudo /sbin/service postgresql start echo "Mounting of encrypted folders complete." exit 0
However, if the different folders use different encryption password then following script can be used instead:
#!/bin/bash function mount_encfs() { while : do echo "Enter encfs password for $2 : " sudo encfs --public $1 $2 echo -n "Rerun encfs for $2 (y/n) : " read VAL1 if [[ "$VAL1" = "n" || "$VAL1" = "N" ]] ; then break fi echo done } mount_encfs /mnt/data1/raw_folders/documents_raw /documents mount_encfs /mnt/data1/raw_folders/personal_raw /personal exit 0
<yambe:breadcrumb>Useful_bash_shell_scripts|Useful bash shell scripts</yambe:breadcrumb>