Home > linux, software > ssh keys and encrypted home directory

ssh keys and encrypted home directory

If home is encrypted, sshd cannot access your authorized_keys file. Therefore key based auth only works after loging in via passwort to unlock home. Solution is to change the location where sshd looks for the keys to a folder outside encrypted home:

mkdir /etc/ssh/william
chown william:william /etc/ssh/william
mv /home/william/.ssh/authorized_keys /etc/ssh/william/
vim /etc/ssh/sshd_config 
AuthorizedKeysFile /etc/ssh/%u/authorized_keys
service ssh restart

This solution is also described here: https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Troubleshooting


Categories: linux, software Tags:
  1. bert
    March 26th, 2013 at 13:43 | #1

    Thanks for the hint. but I’d rather put the authorized_keys file into the /home partition. I would suggest under /home/.ssh/$USER

    And for convenience I would use pam_mount to bring back my authorized_keys file into my $HOME:

    <volume path="/home/.ssh/william/authorized_keys" mountpoint="~/.ssh/authorized_keys" options="bind"></volume>

    in your own pam_mount.conf.xml or in the system wide file use this:

    <volume path="/home/.ssh/%(USER)/authorized_keys" mountpoint="/home/%(USER)/.ssh/authorized_keys" options="bind"></volume>

    Note that you need at least version 2.9 of pam_mount to use a bind mount on files.

  2. March 20th, 2014 at 13:06 | #2

    They are also the entry through which very many people
    enter their homes at the end of long days. With the garage door closed, place the ladder below
    the motor and find the limit switches. Rolling shutters of ROMA have a patented sound body and are therefore
    pleasantly quiet.

  3. September 2nd, 2014 at 23:12 | #3

    I must thank you for the efforts you have put in writing this blog.
    I really hope to chedck out the same high-grade blog posts from you later on as well.
    In fact, your creative writing abilities has encouraged me
    to get mmy own, personal blog now 😉

  4. September 28th, 2014 at 08:23 | #4

    With havin so much content and articles do you ever run into any
    problems of plagorism or copyright infringement? My site has
    a lot of exclusive content I’ve either authored myself or
    outsourced but it looks like a lot of it is popping it up all over the internet without my agreement.
    Do you know any techniques to help reduce content from being stolen?

    I’d certainly appreciate it.

  1. No trackbacks yet.