Author Topic: Encrypt Swap Partition  (Read 643 times)

Offline oracle2b

  • Full Member
  • ***
  • Posts: 66
  • 'Impossible is for the unwilling' - John Keats
Encrypt Swap Partition
« on: May 01, 2011, 12:50:05 AM »
I'm no expert but since I couldn't find any instructions on the forums to easily encrypt swap I decided to make a quick guide.

For the purpose of this guide, the swap partition will be /dev/sda3

Identitfy your own swap partition with this command :
Quote
fdisk -l

To begin, open a root shell by pressing alt+F2 and typing konsole or the name of your preferred terminal.

Switch to root user.
Quote
su root

To start, close any unnecessary applications so you can proceed to turn off swap.

Quote
swapoff -a

Create a file to tell PClinuxos that the swap partition should be encrypted. Use your favorite text editor to create a new file named /etc/crypttab and enter the following data into it, separated by tabs:

swap    /dev/sda3    /dev/random    swap,cipher=aes-cbc-essiv:sha256

REMEMBER TO REPLACE /dev/sda3 with the location of your actual swap partition.

This will cause a new device /dev/mapper/swap to be created at next boot which uses the default AES encryption and highly random data for the encryption key. Each time you reboot, the swap space will be re-created using a different random key.

Finally, you need to edit /etc/fstab to point to the new encrypted swap device. you’ll find a line such as this:

/dev/sda3   swap    swap    defaults    0 0

Change it to this:

/dev/mapper/swap    swap    swap    defaults    0 0


Now reboot