How To Hide & Protect Files or Folders in Linux
In this opportunity this tutorial will analyze how to hide a file in Linux, in this case, we will work with Ubuntu 16.04, but the procedure is identical to the other distros.
How to Hide a File in Linux
The process is simple and is the result of a development error that finally turned out to be a safety feature. To hide a file in Linux we must, first, locate and select it.
Once selected, we proceed to rename it using one of the following options:
- Pressing the F2 key .
- Right clicking on the file and selecting the Rename option.
In the open window to edit the new name, simply add a period (.) To the beginning of the file name:
This will cause the selected file to be hidden in the folder. We can do this same procedure to hide a folder.
How to See Hidden Files in Linux
To visualize those files that for security we have hidden, we have two options in Linux, through the File Manager or the Terminal.
How to view hidden files from File Manager
The method with this alternative is simple; we must access the File Manager and there right-click on the white area below the archives. In the menu displayed, check the box Show hidden files:
We can see that the hidden files are now visible.
Note: You also can use a crucial typical combination CTRL + H to see hidden files
How to see hidden files from the terminal
For this, we access the folder where we have the hidden files using the cd command, and once we are in the correct directory we will use the following command to visualize the hidden files:
We observe our hidden files there. The syntax of the command is:
- ls: Display all the elements of a directory.
- -a: Shows the hidden files.
Security Measures to hide files in Linux
The previous method allows us to protect our data safely and functionally, but if we want to increase security levels we can make use of the following options:
Compress the file or folder with a password
This method allows us to reduce the file size, add a password and hide it, which significantly improves the security and privacy of the file.
To compress a file or folder, we will perform the following process:
Right-click the element to protect and select the option Compress.
In the expanded window we select the type of compression format and it is important to prefix the file name with the dot (.) To hide the file.
Finally we will select the location where the file is to be stored and establish the respective password.
Encrypt the directory
Multiple tools allow us to encrypt our directories with a password to restrict access to them. Gnome Encfs Manager is a simple and powerful tool for this type of tasks:
If we want to install Gnome Encfs Manager we must execute the following commands in their order:
sudo add-apt-repository ppa:gencfsm sudo apt-get update sudo apt-get install gnome-encfs-manager
We can also prefix the dot (.) To hide the selected directory.
In this way we have several options to hide sensitive files in Linux systems and thus preserve the integrity of these.