{"id":696,"date":"2009-07-18T14:59:43","date_gmt":"2009-07-18T19:59:43","guid":{"rendered":"http:\/\/www.summet.com\/blog\/?p=696"},"modified":"2009-08-15T15:26:56","modified_gmt":"2009-08-15T20:26:56","slug":"encrypted-home-partition-for-ubuntu-9-04","status":"publish","type":"post","link":"https:\/\/www.summet.com\/blog\/2009\/07\/18\/encrypted-home-partition-for-ubuntu-9-04\/","title":{"rendered":"Encrypted home partition for Ubuntu 9.04"},"content":{"rendered":"<p>Following the <a href=\"http:\/\/blog.gnist.org\/article.php?story=EncryptedSwapAndHomeUbuntu\">directions on Lars&#8217; blog<\/a>, I set up an encrypted home directory on Ubuntu 9.04 using LUKS.<\/p>\n<p>The following commands were all executed with root permissions. Add &#8220;sudo&#8221; to the front of the commands if you are not running with root permissions. <!--more--><\/p>\n<p><code><br \/>\napt-get install cryptsetup libpam-mount<br \/>\ncryptsetup -c aes-cbc-essiv:sha256 -y -s 256 luksFormat \/dev\/sda7<br \/>\n<\/code><br \/>\nThe partition I used was \/dev\/sda7, replace that with the partition you created. It will ask you for a password, I suggest using the same password as your login.<br \/>\nThen, to map the encrypted partition to \/dev\/mapper\/cryptohome, do this:<br \/>\n<code><br \/>\ncryptsetup luksOpen \/dev\/sda7 cryptohome<br \/>\n<\/code><br \/>\nThen create a  (ext3) filesystem. You may substitute a file-system of your choice here, but ext3 is the most widely used, and therefore, tested.<\/p>\n<p><code><br \/>\nmkfs.ext3 -j -m 1 -O dir_index,filetype,sparse_super \/dev\/mapper\/cryptohome<br \/>\n<\/code> (-m 1 and sparse_super save space, and should be safe as this is not a root filesystem. Note that the O for options is capitalised, and you may NOT have spaces after the commas that separate the options.)<\/p>\n<p>To test that everything is working, unmount it, try to mount it again and make sure you can write a file to the partition and unmount\/close it!<\/p>\n<blockquote><p>\n<code><br \/>\ncryptsetup luksClose cryptohome<br \/>\ncryptsetup luksOpen \/dev\/sda7 cryptohome<br \/>\nmkdir -p \/mnt\/test<br \/>\nsudo mount \/dev\/mapper\/cryptohome \/mnt\/test<br \/>\ntouch \/mnt\/test\/testfile<br \/>\nls \/mnt\/test<br \/>\numount \/mnt\/test<br \/>\ncryptsetup luksClose cryptohome<br \/>\n<\/code>\n<\/p><\/blockquote>\n<p>To make it mount automatically when you log in:<br \/>\nMake sure you do not have a partition listed for your home directory in \/etc\/fstab.<\/p>\n<p>Add a line in \/etc\/crypttab:<br \/>\n<code>cryptohome \/dev\/sda7 noauto luks<\/code><\/p>\n<p>And configure pam_mount in \/etc\/security\/pam_mount.conf.xml to auto-load your encrypted home directory on login:<br \/>\n<code>&lt;volume user=\"summetj\" fstype=\"crypt\" path=\"\/dev\/sda7\" mountpoint=\"\/home\/summetj\" \/&gt;<\/code><\/p>\n<p>Note that initially the users home directory will be owned by root, and you will have to chown -R <username> on the home directory to make things stop complaining. Doublecheck that the &#8220;testfile&#8221; you created earlier is in the users home directory.<\/p>\n<p>If you get an error message that says: pam_mount(pam_mount.c:100): unknown pam_mount option &#8220;use_first_pass&#8221; you can get rid of it by editing the \/etc\/pam.d\/common-pammount and \/etc\/pam.d\/common-auth files and removing the &#8220;use_first_pass&#8221; option from both of them.<br \/>\n<\/username><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following the directions on Lars&#8217; blog, I set up an encrypted home directory on Ubuntu 9.04 using LUKS. The following commands were all executed with root permissions. Add &#8220;sudo&#8221; to the front of the commands if you are not running &hellip; <a href=\"https:\/\/www.summet.com\/blog\/2009\/07\/18\/encrypted-home-partition-for-ubuntu-9-04\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,3,13,12],"tags":[],"class_list":["post-696","post","type-post","status-publish","format-standard","hentry","category-commentary","category-linux","category-projects","category-goodlinks"],"_links":{"self":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/696","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/comments?post=696"}],"version-history":[{"count":0,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/696\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/media?parent=696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/categories?post=696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/tags?post=696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}