Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Can you tell me that how encryption and decryption of files and folders work in linux or Ubuntu 12.04 LTS ? And also tell me how i can implement encryption and Decryption of files and folders in Ubuntu during Log in and Log off?

share|improve this question
    
See also this question: askubuntu.com/questions/166199/… –  user76204 Sep 25 '12 at 16:33
add comment

1 Answer

In essence, you have three main options:

  1. Encrypt a whole drive
  2. Encrypt your home directory (where your user-specific files are)
  3. Encrypt a particular directory in your home directory (for example, if you want only to protect some sensitive data, but not everything).

If you did not choose option 1. or 2. during installation of Ubuntu, the simplest solution is to select option 3, or, which is far more complex, migrate your home to an encrypted directory (see this guide).

Option 3, in a simple form, creates an encrypted folder called ".Private" in your home directory, and while you are logged in, you can view your files in a decrypted form in a folder called "Private" (without a dot). To do that, open a terminal window (press CtrlAltT), and copy the following commands:

sudo apt-get install ecryptfs-utils
ecryptfs-setup-private

You will be asked first for your login password, and then for another password to encrypt the directory.

An alternative to the above is using encfs to encrypt just any directory on your disk; however, a little more command line will be necessary.

sudo apt-get install encfs

To setup a directory encrypted in /path/to/encrypted and accessible in decrypted form in /path/to/decrypted, do

mkdir -p /path/to/encrypted /path/to/decrypted
encfs /path/to/encrypted /path/to/decrypted

The first time you run it for a given directory, you will be prompted for a password and a few setup options. To unmount it (such that no decrypted files are visible), type

fusermount -u /path/to/decrypted

To mount it again ("decrypt" it), type again

mkdir -p /path/to/encrypted /path/to/decrypted
share|improve this answer
    
Using Truecrypt is also another option, although it's not in the repositories. –  user76204 Sep 25 '12 at 16:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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