How to Encrypt Files in Linux
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
- 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?
May be interested
- How to Use KUserkuser is an application used in many linux distros to create, delete, or manage user accounts. these instructions assume you are using the kde 4 version (the more recent version). click the 'add' button on the top toolbar.
- How to Change the Position of the Wbar Dock in AV Linuxin the latest av linux version, the wbar dock is located at the top of the screen. this can be quite annoying to those who are use to using it from the bottom. this small problem can be quickly solved by following the steps below. open...
- How to Set up Php on Apache 2.2.3 on CentOS 5.3this article is aimed at people who have centos 5.3 and apache 2.2.3. it may also work on rhel (but you have to pay for rhel). connect to your vps using ssh to get a command line (unless its being installed on your local machine). your...
- How to Send Mail in Linuxthis wikihow teaches you some basic ways to send email on your linux desktop system. if you're using a desktop version of linux like debian or ubuntu, the operating system comes with a built-in graphical mail app called thunderbird. if you...
- How to Start a Prboom Multi Player Game in Linuxthis is how to start a prboom multi-player game in linux from the terminal inside of the gui. this tutorial is for playing over a local area network (lan) with up to 4 players. make sure you do it from the terminal from inside the gui. if...
- How to Install Software on Linuxthis wikihow teaches you how to download and install new apps on your computer, using a linux operating system. in most linux distributions, there is a dedicated app that comes with a simple graphical user interface (gui) for installing...