Easy mount/umount luks encrypted partitions

This commit is contained in:
Thomas Forgione 2022-02-16 16:09:13 +01:00
parent 611ab5791f
commit ec14c1c073
2 changed files with 38 additions and 0 deletions

19
bin/lmount Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
if [ "$#" -ne 2 ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program expects two arguments\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lmount <drive> <mount point>"
exit 1
fi
if [ "$USER" != "root" ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program must be run as root\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lmount <drive> <mount point>"
exit 1
fi
# Mounts an encrypt external drive to a specified mount point
cryptsetup luksOpen $1 external
mount /dev/mapper/external $2

19
bin/lumount Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program expects one argument\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lumount <mount point>"
exit 1
fi
if [ "$USER" != "root" ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program must be run as root\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lumount <mount point>"
exit 1
fi
# Mounts an encrypt external drive to a specified mount point
umount $1
cryptsetup luksClose external