Skip to content

Instantly share code, notes, and snippets.

@theandrewbailey
theandrewbailey / encmount.sh
Created May 1, 2021 00:46
bash script to unlock, mount, backup to, unmount, and lock an encrypted external drive
#! /bin/bash
backupfrom="/srv/smb/"
blockdev=${1:-/dev/sdd1}
permunlock=$(pkaction|grep org.freedesktop.udisks2.encrypted-unlock)
permmount=$(pkaction|grep org.freedesktop.udisks2.filesystem-mount)
if [[ -z "$permunlock" ]] || [[ -z "$permmount" ]]; then
echo "enter disk password first, then login password twice"
echo "login password prompts can be eliminated via polkit"