If you haven't seen the "How to Encrypt a file using GnuPG" article, Go see it first.
1. Change your Directory. (Change your directory to the directory which you have the encrypted file placed. Which in my case is the "test1" directory. We will use the cd command to change directory)
cd test1/
2. Create a new file named "Decrypt.sh". (Now create a file with name Decrypt.sh, This will be the file which will decrypt the encrypted file your having)
> Decrypt.sh
3. Edit the file "Decrypt.sh". (Now edit the file using your favourite editor, In this tutorial we will be using Nano Editor)
nano Decrypt.sh
4. Add the Decryption script to the text file (Now we will add the decryption script to the text file through nano editor. Copy/Paste the following script down below to the Decrypt.sh file)
--------------------------------------------------------------------------------------------------------------------
#!/bin/bash
echo "Welcome, I am ready to decrypt a file/folder for you"
echo "Currently I have a limitation, Place me to the same folder, where the file to be
decrypted is present"
echo "Enter the Exact File Name with extension"
read file;
gpg -d $file>DecryptedFile.txt
echo "I have decrypted the file succesfully"
echo "Now I will be removing the encrypted file"
rm -rf $file
--------------------------------------------------------------------------------------------------------------------
5. Save the script to the file. (Now save the script to the file and exit from the editor)
CTRL+X (Hold Control key and press X)
6. Change the files access permissions to 755. (Now change the file access mode to 755, We use the command chmod to change/revoke a files permissions)
chmod 755 Decrypt.sh
7. Execute the command "./Decrypt.sh" (Now execute the ./Decrypt.sh command from the console. You will be promopted to state the file name and then to enter the password/passphrase once)
./Decrypt.sh
8. File is Decrypted now. (Your file is currently decrypted. Goto your directory and check for a file named "DecryptedFile.txt" for the decyrpted informations)
nano DecryptedFile.txt
Have Doubts/Questions? Please comment down below on the post or email me at BLinuxYT[at]outlook.com
@Black Linux/Skyie/AutoBotIRC - Buuuuurp Geeky!
Please Login or Sign Up to leave a reply.