How to Encrypt Files in Linux
You may not want people to see important files on your computer, particularly if it has multiple users. There are several different ways to restrict access to a particular file in the system, but unfortunately, most of them consume a lot...
Method 1 of 2:
Encrypting a File
-
Install GnuPG first. Open the terminal and enter the command sudo apt install gnupg. The installation process will start. -
Navigate to the folder where you store the file that you are going to encrypt. Right-click and choose Open Terminal from the menu. -
Enter the the command gpg -c file1.txt, and press ↵ Enter. Replace "file1.txt" with the name of the file you want to encrypt. -
Enter the passphrase. You can choose any suitable passphrase you want; it will as you to re-enter the phrase for the confirmation. Don't forget the phrase! -
Remove the original file by typing the command rm file1.txt. Replace "file1.txt" with the right file name. Your encrypted file will be created with the extension ".gpg" in the same directory. -
Reload the agent. Sometimes GnuPG will cache your passphrase, meaning anyone can decrypt the file without the passphrase. To avoid this, use the command gpg-connect-agent reloadagent /bye.
Method 2 of 2:
Decrypting the File
-
Open the terminal to the folder where your encrypted file is located. The file has the .gpg extension. Just copy the name of the file from there. - Type the command gpg file1.txt.gpg. Remember to type your file name instead of "file1.txt.gpg".
-
Enter the passphrase. - Wait for your original file to be generated. Then you can open it!
Discover more
file enter txtShare by
David Pac
Update 04 March 2020
You should read it
- What is ISO file?
- How to fix the problem of being unable to enter Terminal in Linux
- How to change the direction of the Enter key in Excel
- How to convert a scanned file to Word
- How to enter formulas in Excel
- The Quiet Details That Make a Sports Betting Platform Feel Reliable
- Instructions on creating toy set images with ChatGPT AI
- How are AI agents changing the journalism industry?
- How to Use KUser
- How to Change the Position of the Wbar Dock in AV Linux
- How to Set up Php on Apache 2.2.3 on CentOS 5.3







