How to password protect a single folder on Ubuntu?

1

I need to password protect a single directory on Ubuntu.
1. The folder must be encrypted.
2. Be easily accessed on a regular basis.
3. If possible, the folder should be portable.

How can I achieve this goal?

Thanks.

thedp

Posted 2016-01-14T18:19:29.727

Reputation: 255

What do you mean by portable? – user2121874 – 2016-01-14T18:21:48.587

Portable, as in I can move it to USB, other machine. But it's not a must. – thedp – 2016-01-14T18:26:11.953

Portable to what types of other systems? The first thing that comes to mind is encrypting the folder as a catch-all solution; the encryption key would be required to later unencrypt it and all that would be required on the other machine is the package to do so. How much data will be in this folder? – sherrellbc – 2016-01-14T18:35:15.237

Do you need to be portable across operating systems? i.e. do you want to be able to open this on MS Windows? – user2121874 – 2016-01-14T18:38:41.620

@user2121874 no, just between other Debian based machines. – thedp – 2016-01-14T23:02:17.483

@sherrellbc the max size won't exceed 100MB – thedp – 2016-01-14T23:03:04.267

Okay, then use the DM-Crypt + Loopback solution that I linked to at the top of my answer. – user2121874 – 2016-01-15T00:59:54.677

@user2121874 Thank you. But I've decided to go with eCryptfs, it seem easier. – thedp – 2016-01-15T01:19:19.883

Answers

1

ecryptfs works very well too. install ecryptfs-utils first

instrucs here for debian, but will apply similarly. https://www.howtoforge.com/tutorial/how-to-encrypt-directories-and-partitions-with-ecryptfs-on-debian/

I have 2 folders encrypted in this way

Pingers.

Pingers

Posted 2016-01-14T18:19:29.727

Reputation: 337

1

Assuming that it does not need to be portable across operating systems, then this is probably what you are looking for. (DM-Crypt + Loopback File)

It is really trivial to create mount and unmount scripts for this kind of setup, that way you don't need to memorize all the steps to bring the encrypted folder online. Just make sure to remember to copy the scripts as well if you want to move the folder to another system.

If you really do need portability across Operating Systems, then TrueCrypt v7.1.a is what you are looking for. Make sure you get it from the verified mirror on GitHub, or you might be installing a Trojan. The reason why I don't recommend using this unless you absolutely need portability across Operating Systems is that there is still some question as to whether or not TrueCrypt has been broken by the Feds.

user2121874

Posted 2016-01-14T18:19:29.727

Reputation: 171

0

The venerable TrueCrypt has versions for most OS's, including Linux distros and Windows. It is simple to create a folder as a TrueCrypt container. Caveat: questions were rised about the trustworthiness of that encryption, and VeraCrypt might be an alternative, though I have seen no independent audit of VeraCrypt yet.

Another choice is simply to archive the folder with 7-Zip or PeaZip and use a password. Again, these applications are available for many OS's.

DrMoishe Pippik

Posted 2016-01-14T18:19:29.727

Reputation: 13 291

1

Though I would probably steer clear of it unless I absolutely needed portability across Operating Systems: http://www.theregister.co.uk/2015/08/04/truecrypt_decrypted_by_fbi/

– user2121874 – 2016-01-14T19:16:24.157

1Also, you should definitely prefer TrueCrypt v7.1.a over VeraCrypt as VeraCrypt has not had an independent audit (While TrueCrypt v7.1.a has had several). – user2121874 – 2016-01-14T19:18:49.430

0

EncFS is a good non-container (not a fixed size like TrueCrypt or dm-crypt/LUKS) variable size folder/file encryption system. It's available on any Debian system too.

Similar to eCryptFS, but EncFS keeps it's config file inside the encrypted folder and can be mounted rather "portably" and easily, whereas eCryptFS would require knowing the mount options or copying some extra config files to special folders before mounting.

Also EncFS does not need root privileges to run (like eCryptFS does), so EncFS is more "portable" running as a regular user only.

Xen2050

Posted 2016-01-14T18:19:29.727

Reputation: 12 097