Sometimes you may need to send a important files as a attachment thru emails. Better if the files was sent in encryption mode then unauthorized person can’t misuse the file.
Now we will see here how to encrypt and decrypt the file in Linux.
To encrypt a file :
File can be encrypted using gpg command as shown below
#gpg -c test.txt>
once you issued the command then you will get a popup window to enter the password twice.
Now the new encrypted file test.txt.gpg is created in the same directory and nobody can read the content in this file without decrypt the file and this can be done only who knows the password.
To make sure the file test.txt.gpg is decrypted, Run cat test.txt.gpg
Let see how to decrypt the test.txt.gpg to read the content
To Decrypt the file, just run gpg command without any option
Now you will be prompted to enter the password, enter the password which you have set while encrypt the file.
Once password authentication successful then file will be decrypted and content is readeable.
I hope you like this article, If yes then Pls. share this article with your friends.