How to Encrypt File and Folder in Linux
Linux is an open-source operating system and is known to be the most secure, and to some extent, it is true. But, are we fully secured on Linux? The answer is no and hence requires a call for encryption of files and folders in Linux. Even the new update released for ZFS on Linux encryption (ZoL 0.8) on May 23, 2019, presents us with a more secure native encryption feature.
To enable Linux to encrypt file with a password or for Linux to encrypt a folder with a password, you need to follow different methods that we shall discuss below.
How to encrypt a file in Linux
Step 1: Install GnuPG in Ubuntu
GnuPG also called 'Pretty Good Privacy’ is an OpenGPG standard's free implementation security used to encrypt and sign files to send to others. For installation, press Ctrl + Alt + T to open Terminal Window. The installation shows as Sudo apt install gnupg2.
Step 2: Set the Cipher Algorithm
Run the following command to get a list of various ciphers.
Set the AES cipher algorithm AES128 as default. You can change it to different cipher algorithm with the help of configuration file GnuPG uses. Add the line to a configuration file called gpg.conf which is available in a hidden directory.
Run this command and edit the gpg.conf in gedit as follows.
Add the line to empty file opened in gedit to change the default cipher algorithm to AES256 as follows.
Save the file after making changes.
Step 3: Linux encrypt a file
In this step, use the asymmetric key encryption method to encrypt a file in the form of blocks or chunks. Find the data using the command line or the File Manager. Use the following command for encryption.
gpg --symmetric ~/Documents/PrivateFiles/MyPrivateFile.txt
Step 4: Linux encrypt a file with password
Finally, add passphrases and secure the file with a password. It will get saved in Private Files after which you can securely delete a non-encrypted file. To change the name, add –o in the previous command as follows.
gpg -o MyPrivateFile.enc --symmetric ~/Documents/PrivateFiles/MyPrivateFile.txt
How to encrypt a folder in Linux
Step 1: Install Gnome Encfs Manager
Use the following command to install the updated Gnome Encfs Manager.
Sudo add-apt-repository PPA:gencfsm Sudo apt update Sudo apt install gnome-encfs-manager
The dialog box will appear with an already selected OK button. Press Enter to continue the installation.
Step 2: Create a new encrypted directory
For Linux to encrypt directory, create a new encrypted directory called a stash.
After you run the program, click the '+' icon to create a stash. Create multiple stashes, if required, in a similar way. Set the location for this encrypted directory under a directory or drive to encrypt or import.
Step 3: Mount directory
The mounting directory allows you to access it on different devices. After mounting, you can see it File Manager as a drive. Open the directory you want to mount and enter a strong password. It will fulfill your requirement of the Linux encrypt a folder with a password.
The encrypted folder is automatically mounted and will show up in the left panel on the File Manager.
Step 4: Unmounting an encrypted folder
The last step is to unmount the folder for encryption and prevention from outward access.
Uncheck the mounted icon in the Gnome Encfs Manager program window to unmounts the selected folder.
Note: Rather than selecting a folder with unprotected files, create a new folder to move password protected files.
Best PDF tool for Windows and Mac
If you want to encrypt PDF files on Windows and Mac, you can try Wondershare PDFelement - PDF Editor. It is an all-in-one PDF solution for editing, annotating, creating, converting and protecing PDF files. It is the best alternative to Adobe Acrobat Pro DC, with the same features but a much more lower price.
- You can create, edit, convert, sign, comment, and review, etc.
- Protect your documents with permissions and passwords for information exchange.
- Enable redact information to delete sensitive data permanently from documents.
- Add digital signatures to further protect the document with integrity and authenticity.
- Optical Character Recognition to adjust or edit the document without disturbing the original format.
- Create accessible fillable PDF forms.
- Export data from scanned PDFs.
- It uses robust security of 256-bit AES encryption for passwords, permissions, and digital signatures.
- It uses customer-friendly text editors with a whole new level.
Tips for encrypting file/folder on Linux
Encryption technology is the best to live a secure life with lots of sensitive data. Here are some benefits to encrypt the file/folder on Linux.
- Use the documents across various devices.
- It helps you stay secure in remote working.
- It supports data protection and integrity.
- You should use it as a privacy safeguard.
- It helps to build trust in the Linux OS.
- It protects confidential data from privileged users and other administrators.
Buy PDFelement right now!
Buy PDFelement right now!
- Top 5 Excel Password Recovery Online Free Tools in 2024
- Top 5 Encrypting File System (EFS) in 2024
- How to Remove Zip Password Online with the Best Zip Password Unlocker
- 5 Ways to Protect PDF from Copying
- The Most Efficient Way to Protect PDF from Editing