Computer

Protect your personal files and folders on Linux

By default, all the folders that we create in any operating system (Windows, Linux, macOS) are visible folders, which we can see from the explorer and access them, without problems, and all their content. However, folders and files can be configured, in one way or another, to appear as hidden. In the case of Windows, for example, it is an attribute that we can activate from the properties window to achieve this end. On Linux, on the other hand, we need to make a slight change to the name (add a period at the beginning) so that, in the eyes of the operating system, the folder remains hidden.

Of course, before starting we must bear in mind that a hidden file or folder on one system (such as Windows) will not be hidden on another system (such as Linux) due to the different ways of carrying out this configuration. And the same applies the other way around.

Hide files and folders from Terminal

The first way we are going to see to hide files and folders is from the Linux Terminal. That is, through commands. We can open the terminal from the desktop of our favorite distro using the keyboard shortcut Ctrl + Alt + T, or go directly to a TTY and do it from there. The process, and result, will be the same.

Once in the terminal, using the command “cd” we move to the directory where we have the folder. In our example, we start with a folder called “SoftZone” within our home directory (user). So the command will be:

cd /home/usuario

What we must do is rename the current folder to add the period at the beginning. And we do this using the command «mv» (to move) in the following way:

mv SoftZone .SoftZone

We already have the hidden folder. If we now use the “ls” command to list all the contents of a directory we can see that our “SoftZone” folder is no longer listed. And if we enter from a file explorer, like Nautilus, we will not be able to see it either.

Hide Linux folders

To hide individual files, the process is the same. All we have to do is change the name of the folder to that of the file (and its extension) as follows:

mv archivo_sz.txt .archivo_sz.txt

Ready. The file will now be hidden, and we will not be able to see it.

Finally, using “mkdir” or “touch”, with any name that begins with a period, we can create hidden files and folders from scratch.

How to hide folders and files in Ubuntu

If we prefer, we can do the same from any graphical environment, such as GNOME. To do this, all we have to do is find the file or folder that we want to hide, and change the name (by right-clicking on it) to the same, starting with point. In this way we will leave the file or directory hidden and away from prying eyes.

Rename folder hide Linux

We can also quickly change the name using the F2 key.

Once the file or folder is renamed, it will no longer appear in the browser. And, in the same way as in the previous step, if we use the “ls” command to see a list of all the files and directories that we have, these hidden ones will not appear.

So how do I get back to my hidden files?

View hidden files and folders

There are two ways to view these files on Linux. The first one, since we have started explaining how to do it from terminal, is to use the command «ls», with a special parameter, to be able to carry out this task. To do this, we simply have to go to the directory that we want to list, and execute the command as follows:

ls -a

By adding the “-a” at the end, now “ls” will be able to see and list all hidden files and folders. And we will recognize them quickly because in their name they will begin with a point.

And, if we are one of those who use a graphical interface in Linux, we can also do so by activating a box in the preferences of our file explorer. For example, in the case of Ubuntu, GNOME and Nautilus, what we must do is open the preferences panel and check the next box in the options.

Show hidden files Nautilus Linux

We can also show and hide hidden files with a simple keyboard shortcut: Control + H. The result, in the end, is the same.

Other ways to protect personal files

Hiding them is a quick and easy way to protect everything that we do not want to fall into the wrong hands. But, of course, it is not an armored method, and with a little knowledge anyone could see all those files again. Fortunately, there are other ways to protect the most private of Linux systems. And we are going to see some of the most effective.

Change permissions

The Linux permission system is one of the most important aspects of this operating system. Thanks to it, we can have absolute control over who can, or cannot, see, read or write to our files.

We can change the permissions using the «chmod» command from a terminal, although if we don’t want complications we can also do it from the properties window, specifically in the «tabPermissions«.

Change Nautilus permissions

It is enough to remove the permissions from the “Others” users so that no one other than us, or who belongs to the same group, can not even see these files.

Compress and encrypt

If we do not want, or do not know, to modify the permissions of Linux files and directories, there is another little trick that will allow us to protect our most sensitive data equally (or, better said, better): encrypt it. To do this, we can create a new compressed file (in ZIP) and password protect it. Inside we will put all the files that we want to protect so that, without the password, nobody can enter. Of course, the ZIP file can start with a period so that it is also hidden.

And another way to protect our more sensitive information (if we have the knowledge to do so) is to use Gnome Encfs Manager. This tool allows us to create a secure and encrypted container, inside which we can place all the files we want. To use it, we will have to mount it (with its password) to decrypt and access the data.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *