I need to encrypt a folder with documents (about 560kb if that makes any difference) and I was wondering whether it was possible to accomplish that using the command line?

I am searching for something like this:

encrypt /path/to/folder encryption_method password

than can be decrypted the same way

decrypt /path/to/folder encryption_method password
  • What counts as "unnecessary software"? The software to encrypt and decrypt would probably be necessary for this sort of problem, right? – Eric Renouf Nov 20 '16 at 12:31
  • I was referring to bloat-ware and it would be preferable to use the software that is pre-installed if there are any. Sorry if that was unclear. I will edit the question and remove that part completely. – Clone Nov 20 '16 at 12:36
  • 1
    Have a look at encfsto have directories encrypted and used as filesystem to mount, even automatically with libpam-encfs. – ridgy Nov 20 '16 at 12:54

You are looking for dm-crypt and cryptsetup.

Basically you encrypt a block device and mount it as directory


You are looking for encfs: It mounts a dir on another dir, so that the files are stored encrypted as normal files. This way you do not need to make a block device.


Another nice option here is to use the tool that has been written by Dyne.


It is a nice set of scripts that handle a number of Unix tools to make encrypting Folders / Files easier.

Main page for the tool is here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.