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!
4.5 ★ | 2 Vote
You should read it
- How to import a password from a CSV file in Google Chrome browser
- Set password protection file not open and save content edit
- 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
- How to Copy Files in Command Prompt
- What does Shift + Enter do in Word? Can it be replaced?
- How to open and read the .DAT file?
- How to convert a Word file to Excel
- What is DMG file?