Skip to content

Instantly share code, notes, and snippets.

@mayhems1
Last active October 2, 2020 18:11
Show Gist options
  • Save mayhems1/c3d99c427ca827ffcfdbab184e4a3936 to your computer and use it in GitHub Desktop.
Save mayhems1/c3d99c427ca827ffcfdbab184e4a3936 to your computer and use it in GitHub Desktop.
encrypt files

encrypt files in Linux cheat sheet

7z

Install

$ sudo apt-get install p7zip-full
# yum install p7zip-full

Encrypt

7za a -tzip -p -mem=AES256 file.zip file.txt
7za a -t7z -mx=0 -p<Password> file1.zip file1.txt

Decrypt

7za e file.zip

gpg

Install

$ sudo apt-get install gnupg
# yum install gnupg

Encrypt

gpg -c file.txt

gpg --batch --output greetings.txt.gpg --passphrase mypassword --symmetric greetings.txt

# Using public and private keys
gpg --gen-key

gpg --encrypt --recipient username@gmail.com files

Decrypt

gpg file.gpg

Other

gpg --cipher-algo AES256 --symmetric file.txt

gpg --list-keys

Usefull links

https://www.tecmint.com/linux-password-protect-files-with-encryption/ https://www.fosslinux.com/27018/best-ways-to-encrypt-files-in-linux.htm https://www.baeldung.com/linux/encrypt-decrypt-files https://linuxhint.com/encrypt_files_linux/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment