PGP encryption for Linux file browser
Secure Nemo and his Nautilius.
Intro
Let’s talk security. Yeah, it’s important, but can we make it less hassle? We all use cloud storage, even if we don’t think about it. Some of it’s so baked into our devices that we barely notice our files aren’t chilling on our hard drives. OneDrive on Windows? iCloud on Apple? Useful but sneaky.
Encrypt script
#!/usr/bin/env bash
# Encrypt
# gpg-encrypt Nautilus script
gpg -c --no-symkey-cache "$1" && rm -f "$1"
PGP encryption script for your file browser.
Encrypting your file? Cool, but heads up - '& rm -f "$1"'
deletes the original after locking it up tight. If you want to hang onto the OG file, nix that option. Pro tip: don’t forget to delete it (or at least clear the trash). Leaving it around is like hiding your house key under the doormat - classic security no-no.
Decrypt script
#!/usr/bin/env bash
# Decrypt
# gpg-decrypt Nautilus script
ext=`echo "$1" | grep [.]gpg`
if [ "$ext" != "" ]; then
gpg --batch --yes --no-symkey-cache "$1"
else
zenity --error --text "The selected file is not crypted."
fi
PGP decrypt script for your file browser.
Using one script for both
If you don't want to use two right-click menu entries, use the one below:
#!/usr/bin/env bash
# Encrypt-Decrypt
# gpg-encrypt/decrypt Nautilus script
ext=`echo "$1" | grep [.]gpg`
if [ "$ext" != "" ]; then
gpg --batch --yes --no-symkey-cache "$1"
else
gpg -c --no-symkey-cache "$1" && rm -f "$1"
fi
Courtesy of StackExchange.