Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Linux Planet
Linux Today
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article

   LinuxPlanet / Tutorials







Protecting Data with Encrypted Linux Partitions
Encrypting the Partition

Carla Schroder
Thursday, June 14, 2007 09:19:24 AM

Once you have a nice new empty partition, you'll encrypt it with the cryptsetup command. Be very sure you are encrypting the correct partition:

# cryptsetup --verbose --verify-passphrase -c aes-cbc-plain luksFormat /dev/sda2

WARNING!
========
This will overwrite data on /dev/sda2 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.

This creates the encrypted partition. Now you need to create and name a mountable logical partition. In this example, it is named sda2, which could be test or fred or mysecretpartition, or anything you want:

# cryptsetup luksOpen /dev/sda2 sda2
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.

This should show as a block device in /dev/mapper:

$ ls -l /dev/mapper
total 0
crw-rw---- 1 root root  10, 63 2007-06-09 18:38 control
brw-rw---- 1 root disk 254,  0 2007-06-09 19:46 sda2

Now put a filesystem on the logical partition:

# mkfs.ext3 /dev/mapper/sda2

Now you need to make a mount point so you can mount and use this nice new encrypted partition. Remember, you must use the device name is from /dev/mapper/. I'll put it in my home directory. Watch for operations that require rootly powers:

$ mkdir /home/me/crypted
# mount /dev/mapper/sda1  /home/me/crypted

Confirm that it mounted, and write a test file:

# df -H

[...]
Filesystem             Size   Used  Avail Use% Mounted on
/dev/mapper/sda2       7.9G   152M   7.3G   3% /home/carla/crypted
# cd /home/me/crypted
# nano test
# ls
lost+found  test

Next: Making it Available to Users »

Skip Ahead

1 The Inevitable Whoopsie
2 Preparing Your System
3 Encrypting the Partition
4 Making it Available to Users





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Jupiter Online Media

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers