How to Password-Protect Files and Folders on Linux
Linux is known for its security and privacy features, but even the most secure operating system needs additional protection for valuable documents. Password-protecting files and folders is a reliable way to ensure that unauthorized people don’t access important files on your Linux computer. In this article, we will guide you on how to password-protect files and folders on Linux.
Step 1: Install EncFS
EncFS is an open-source cryptographic file system that helps in encrypting files on-demand. It allows you to create an encrypted virtual directory where your files will be stored. To install EncFS, open your Linux terminal and run the following command:
sudo apt-get install encfs
Step 2: Create a folder for EncFS
After installing EncFS, create an empty folder where the encrypted files can be kept. In this example, we will create a folder called secret_folder by running the following command:
mkdir ~/secret_folder
Step 3: Set up EncFS
Run the following command to set up EncFS:
encfs ~/secret_folder ~/encrypted_secret_folder
This command creates an encrypted directory called encrypted_secret_folder inside the secret_folder directory. EncFS will ask you for two passwords, one for mounting the encrypted folder and another one for accessing the encrypted files.
Step 4: Move files into the encrypted folder
After the encrypted folder has been set up, you can move any file you want to protect into it. For example, to protect a file called confidential.txt, move it to the encrypted_secret_folder.
mv ~/Downloads/confidential.txt ~/secret_folder/encrypted_secret_folder/
Step 5: Unmount the encrypted folder
After you are done working with the encrypted files, it’s essential to unmount the encrypted folder. This ensures that no one else can access the files unless they have both the passwords. Run the following command to unmount the encrypted folder:
fusermount -u ~/encrypted_secret_folder
Step 6: Access your files
To access your password-protected files, mount the encrypted_secret_folder using the command below:
encfs ~/secret_folder ~/encrypted_secret_folder
You will be asked to provide the two passwords you set up earlier. Once the encrypted folder is mounted successfully, you can access your protected files inside it.
Conclusion
Password-protecting your files and folders on Linux is an effective way to secure your data. EncFS provides a user-friendly method of encrypting sensitive files on-demand. The steps outlined above will help you protect and access your confidential files with ease.