I have created an encrypted drive in which to store sensitive files. I'm wondering if there is a command line tool to unmount the encrypted drive and lock it. If there is, I was going to create a launcher to go in my dock so I can click it and the command will be executed without ever having to open the command line.
I used the command
sudo apt-get install cryptsetup and went into the application
Disks and selected the disk I wanted formatted and selected
Encrypted, compatible with Linux system (LUKS, ext4).
I created a file in
lock and copied it into
/bin so I can run it as a single command. In the file is the following:
#!/bin/bash sudo umount /mnt/luks-79a537ae-8eed-42a3-be85-7c54b920d4a2 sudo cryptsetup luksClose /dev/mapper/luks-79a537ae-8eed-42a3-be85-7c54b920d4a2
sudo visudo and added this line to the file:
amolith ALL=(ALL) NOPASSWD: /usr/bin/apt-get, /sbin/cryptsetup, /bin/umount, /bin/lock
I saved it, exited, and, now, when I run
lock, I am still prompted for my password even though the commands should not require the root password now (AFAIK).