2

I have an encrypted partition that I setup during install for CentOS 6 that I want to mount manually after boot. By default it prompts me for a password at boot time. I was able to get it to not prompt me for a password at boot by commenting the drive out from /etc/fstab and /etc/crypttab (although this is probably the wrong way to do it). I tried adding noauto to both the crypttab and fstab but that didn't seem to help. So I guess my question is a two-parter:

1) How do I properly disable an encrypted partition from mounting automatically on boot?

2) How do I manually mount the partition after boot?

For reference I've enclosed the relevant lines from my fstab and crypttab (as they were setup by default):

fstab:

/dev/mapper/luks-4fa25d53-0dcd-44ab-9f4d-bee5d6f90fce /sec                    ext4    defaults        1 2

crypttab:

luks-4fa25d53-0dcd-44ab-9f4d-bee5d6f90fce UUID=4fa25d53-0dcd-44ab-9f4d-bee5d6f90fce none
  • Try adding noauto as the 4th field in your crypttab file. If it works I'll update my answer. The crypttab manpage, however, seems to indicate that the passphrase is always asked for at boot time. – Scott Pack Aug 3 '11 at 23:21
  • I've added noauto's to both the crypttab and fstab. Looks like you're right about the password always being asked a boot time. Looks like it's time to get creative. – Dan Aug 4 '11 at 15:49
2

You need to add the noauto option to the filesystem in your fstab. That will prevent the automounter, or anything that calls or simulates a mount -a, from mounting it. However, since auto is part of the defaults option set, you should replace it entirely with the explicit options, minus auto. Pulling the full set from the man page, your new entry should look something like:

/dev/mapper/luks-4fa25d53-0dcd-44ab-9f4d-bee5d6f90fce /sec   ext4    rw,suid,dev,exec,nouser,async,noauto     1 2

Now, whether including dev, suid, and exec are appropriate for your file system is something you should consider.

  • Yeah I've tried noauto just as you described previously. It still prompts me for my password at boot. – Dan Aug 3 '11 at 23:07
  • I suspect you need to also remove the entry from the crypttab or modify that as well to not automatically try to unlock the volume. – Zoredache Aug 3 '11 at 23:18
  • This bug looks a bit concerning. bugzilla.redhat.com/show_bug.cgi?id=434696. The last comment seems to indicate there is still not a noauto feature for crypttab. – Zoredache Aug 3 '11 at 23:20
  • The man page, on F15, discusses a noauto option, saying "This device will not be automatically unlocked on boot." Though text further up indicates that the passphrase is always asked for at boot time. Will have to test when I have a test machine available. – Scott Pack Aug 3 '11 at 23:30
  • 1
    I was able to get it to work by just completely commenting out the lines in fstab and crypttab and then following the instructions found here: forums.fedoraforum.org/showpost.php?p=1465010&postcount=6 – Dan Aug 4 '11 at 18:23
0
  1. Don't use defaults as it implies auto which means "mount on boot". For more detail see man mount
  2. As root do an mount /sec.
  • I've removed the defaults and just placed noauto and it still asks me for a password at boot – Dan Aug 3 '11 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.