Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can you configure a headless Ubuntu server to auto-mount an encrypted USB hard drive?

I found this similar question, which explains how to mount the drive from the command line, but the author is unaware of how to automatically mount. However, Nautilus provides this functionality, by asking the user whether or not they want to "remember the password" or "forget the password immediately". If you choose to remember the password, then Nautilus will auto-mount the encrypted drive from then on.

What's the equivalent functionality from the command line? How do you configure Ubuntu to remember the password and auto-mount the drive?

share|improve this question
You want to use keyfiles I think. Here's a post where I set a shared dump partition using LUKS:… Should be the same. – RobotHumans Feb 3 '13 at 3:50

perhaps it will help you, the problem seems to be similar: Securely automount encrypted drive at user login (i will just leave link, because there is no need to rewriting it).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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