Score:0

Mount LUKS encrypted partition at login

vn flag

I would like to mount a LUKS partition on login. The solutions I have found involve using either:

  • a LUKS passphrase that is equal to the user's password, or
  • a keyfile that is stored in the HOME folder

I am looking for a solution that:

  • allows a LUKS passphrase to be different from the user's password, and
  • since my HOME folder is not encrypted, does not leave a keyfile accessible.

Is such as solution available?

I remember that when Ubuntu created a ~/.Private directory using ecryptfs this was possible; how was it done? Can't the same be done with LUKS?

Sebastian avatar
in flag
What is your actual requirement? Are you a single user on your machine and do you want to have a certain partition unlocked when you start up your PC? In that case you can set up the partition to unlock at boot time like explained [here](https://askubuntu.com/questions/1335006/what-is-the-recommended-method-to-encrypt-the-home-directory-in-ubuntu-21-04/1335327#1335327). Or do you have a server that is used by multiple users and each one wants to unlock a certain partition on login, but not at boot? In that case a simple script that is executed after login could do the job.
toliveira avatar
vn flag
@Sebastian, doesn't the solution explained in the link you refereed to require the LUKS passphrase and the user's password to be the same?
Sebastian avatar
in flag
No, it does not! I am doing it like that myself, with two different passwords. The OS will ask the passphrase for the partition to be unlocked first, then it will proceed to the login screen, but both are completely separate.
toliveira avatar
vn flag
@Sebastian, "The OS will ask the passphrase" at each login? I wanted to mount it automatically at login, and now I see the question wasn't clear about this point.
Sebastian avatar
in flag
No, the passphrase to unlock the partition is only asked when you boot. After that you can logout and login and it will only ask the user's login password.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.