Hey guys! My College’s Wi-fi troubled me this whole day and finally after midnight I am getting enough speed to post this article. So friends let’s utilize this time just because KL HO NA HO. Today we’ll learn to encrypt a file partition in Red Hat Enterprise Linux.

Actually this is quite simple as all you need to do is to follow these steps-

  • Create a new partition with fdisk which we will encrypt.
  • Now issue cryptsetup luksFormat /dev/vdaN and enter the password you want to set to access this partition. Here vdaN represents your partition and it may be like sda6 or vda6.
  • Now if you want to access this partition then issue cryptsetup luksOpen /dev/vdaN name and it will open the partition as /dev/mapper/name.
  • Now create an ext4 filesystem on this partition as mkfs -t  ext4 /dev/mapper/name.
  • Now create a mount directory as mkdir /encrypted.
  • Now mount the partition as mount /dev/mapper/name /encrypted.

Whoa it’s done.