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?
1 Answers
In essence, you have three main options:
- Encrypt a whole drive
- Encrypt your home directory (where your user-specific files are)
- 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
- 37,208