How to Password Protect a Folder on Linux/Unix without Encryption

17645

As operating systems, Linux/Unix put the user’s privacy and safety above all. While this has resulted in a product that many people swear by, it’s also led to certain features that may not be easy to discern at first sight. For instance, the possibility of password protecting directories without using encryption is something that many people don’t know about. While encrypting is definitely useful, it also has certain issues associated with it, including:

1. Decreased performance

No matter how strong your system is, opening encrypted folders tends to take up a considerable amount of resources, resulting in a slower and more cumbersome computer that’s not always fun to use. 

2. Encryption prevents the folder’s contents from being searchable/indexed

By its very nature, encryption hides content. Therefore, the files inside the folder you’ve encrypted will not show up on any search or index attempts, which can be quite annoying when you’re looking for something specific. 

As you can see, there are a number of issues that pop up whenever encryption is involved. While this kind of protection is necessary for sensitive material, a simple password would be enough to deter strangers from accessing folders of lesser importance. Luckily, Linux/Unix allow for this kind of password protection system as well, as evidenced by the following methods:

1. Changing file permissions

By modifying the permissions of certain files and folders, you can control who gets to access them. This way, they will only be readable by their owner. Anyone who’d want to change these permissions would have to type in a password, or sudo as root, which also requires a password. To change the permissions, just use the “chmod og-rwx filename” command on all the files you want to restrict access to.

2. Create a new user

You can also choose to create a new user for all your protected files and directories. Simply employ the “chown $newuser filename directoryname” and “chmod og-rwx filename directoryname” commands, taking care to replace “$newuser” with the new user account name. By using this method your files will be safe even if you forget to log out for any reason. 

The methods described above do a good job of protecting your folders from unwarranted intrusions without resorting to encryption. Of course, a password protection system would be nothing without a good password, so take the time to come up with something that’s easy to remember for you, but hard to guess for others. Ideally, you should shy away from using information about yourself as a base for any password, since such passwords can rather easily be detected through some basic social engineering techniques. In fact, for most people nowadays it’s much easier to simply use a good password generator instead. These can be readily found online and generate passwords that are much harder to guess. Just be sure to write them down somewhere or use a dedicated password manager, lest you risk getting locked out of your own accounts. 

That concludes our quick guide on how to password protect a folder on Linux/Unix the easy way. Keep in mind that this method is only recommended for sheltering low-priority folders, with encryption still being an irreplaceable tool when it comes to more important content.