If you want to comment about something on this page, go here and create an issue please.
Go back to the beginning of the site
Intro
Encrypting files is good to keep things from seeing what is inside the files. This is a quick introduction on how to encrypt and then decrypt a file. This will be using symmetric encription which only requires a password to encrypt and decrypt a file.
Steps to encrypt a file
- Install gnupg(GNU Privacy Guard) with:
sudo pacman -S gnupg
- Go to a safe directory and do the following
- Open a new file the name ‘junk_file’ in the nano editor with:
nano junk_file
- Type some stuff into the file
- Ctrl+O and ‘enter’ to save(aka “write out”) the file(You can see that command in help of bottom of screen)
- Ctrl+X to close nano
- Enrypt the file with
gpg --symmetric --cipher-algo AES256 junk_file
- gpg = GnuPG program you installed in step 1
- –symmetric = parameter saying to use symmetric encryption
- –cipher-algo AES256 = parameter saying what encryption algorith to use.
- junk_file = path/name of the file to be encrypted
- Create a password when prompted
- A file is created in the same directory as the original file with a .pgp extension. So there will now be a junk_file.pgp file. Use
cat junk_file.gpg
to view the contents of the encrypted file
- Delete the original file with
shred -u junk_file
- shred = overwrites the file with random data
- -u = “unlinks” the file by deleting it
- junk_file = path/name of the file to be shred
Steps to decrypt a file
- Decrypt the file with
gpg --decrypt junk_file.gpg > whatever-new-file-name.txxt
Go back to the beginning of the site