
I successfully followed this guide to create an encrypted drive and have it mounted on login with a gnome
session.
However, I can't get it to automatically mount when I log in via SSH. Is this possible?
I have no problem connecting to the server via SSH and the encrypted home is correctly mounted on SSH log in. The issue only concerns automatic mount of an encrypted external drive.
答え1
No, it can't be done, but you can unlock a locked drive over SSH with the following command:
sudo udisksctl unlock -b /dev/sda1
This command unlocks the /dev/sda1 drive. Your drive will have it's own name. You will then be prompted for a password, and then get a message like the following:
Unlocked /dev/sda1 as /dev/dm-0.
Now you need the mount point, which can be found with the following:
df -h
Which should give you as one of it's lines as the following:
/dev/dm-0 ext4 7.3T 93M 6.9T 1% /media/nas/Extend-1
cd /media/nas/Extend-1 This will get you into the mounted drive. To unmount the drive do the following:
sudo udisksctl unmount -b /dev/dm-0
You should get the following message:
Unmounted /dev/dm-0.
This can be done in the terminal, and over SSH, which is the easiest way to mount and unmount a secure drive over SSH that I know of.