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
- File Management in Unix / Linuxall data in unix is organized in files. all files are organized in folders. these directories are organized in a tree structure that is called the file system.
- Is it possible to run .exe files on Linux?you don't need to trade the appeal of windows software for the stability, security, ease of customization (and even great classic appearance) of linux. in this article, you will be shown how to run windows exe (possibly executable) files and software using the linux operating system. these methods can be applied to any linux distribution, including ubuntu, kali linux, centos and many others.
- How to share encrypted files and self-destruct on Otr.tootr.to is a self-destruct file sharing service and conducts file encryption according to aes 256-bit standard. the file will automatically delete after the time that the user has selected.
- How to use pandoc to convert files on Linuxyou can use pandoc on linux to convert over 40 different file formats. you can also use it to create a simple docs-as-code system by writing to markdown, saving with git and exporting it in any supported format.
- How to create new files in Linuxthere are a number of different linux applications and commands that will create new files for you, even without launching the application. the method you use will depend on your purpose for the file. let's take a look at the options so you can see which one is most useful for you!
- How to Create ISO Files on Linuxtoday's tipsmake will show you how to turn multiple files into one iso file on a linux computer. you need to use the linux command line to do it.
- How to encrypt FILE or FOLDERS on Windows 10, 8, 7how to encrypt files on windows 10? instructions on how to enable file or folder encryption available on windows operating system
- How to Find Files in Linuxif you don't know how, finding files in linux can be quite difficult. here, the best way is to use a few different terminal commands. they are much more powerful than the simple search features on other operating systems, and when you know how to use them well, you will have complete control over your files.
- How to encrypt 256-bit AES files right on Chrome browserto be able to encrypt 256-bit aes standard files on chrome, the browser needs to install an extension called lock it up: password protect files.
- How to copy and rename files in Linuxthere are more ways to copy and rename files on linux than just cp and mv. try some commands and other ways suggested below.