1

I wanted to lock any directory with a password, is it possible to set up pin or password for any directory or file without using third party tools like cryptkeeper.

  • 1
    Create an encrypted archive of it – muru Aug 23 '17 at 10:46
  • i want to lock the file not compress it and then encrypt, isn't there any way to just lock any directory? – Sid Negi Aug 24 '17 at 07:44
  • Folder locking as you want it does not exist. Even if a program provides such a feature, another program will not care about it. If you really want to lock a folder you have to use encryption. EncFS Encryption with Cryptkeeper as GUI is just fine for that purpose. – pLumo Aug 24 '17 at 08:21

1 Answers1

0

You can use ccrypt to encrypt files, use it as follows:

# prompts for the password, encrypts the file and adds “.cpt”
ccrypt /path/to/file

# prompts for the password, recursively (`-r`) encrypts every file
# in the directory and its subdirectories and adds “.cpt” to every file
ccrypt -r /path/to/dir

# prompts for the password, decrypts (`-d`) the file and removes the “.cpt” ending
ccrypt -d /path/to/file

To encrypt a whole directory as one single encrypted file it needs to be packed first, e. g. using tar:

tar cf - /path/to/dir | ccrypt > /path/to/file.tar.cpt # without compression
tar czf - /path/to/dir | ccrypt > /path/to/file.tgz.cpt # with compression

See the manpage for more!

To simplify this you can write a script with these commands and add it to your file manager to get e. g. “Encrypt” and “Decrypt” options in the dropdown menu.


Of course there are other ways to achieve what you want, here some links:

dessert
  • 39,982
  • this works but how to use decryption key to access file/directory using GUI?? Do I have to use some third party application? – Sid Negi Aug 24 '17 at 07:43
  • You need to decrypt it first to access the packed directory, but you can automate this with e. g. ccrypt -d /path/to/file && file-roller /path/to/dir. – dessert Aug 24 '17 at 08:08