While installing Ubuntu 16.04 I decided to take the option of encrypting my home directory. I also use ssh key-only authorization, as password logins are disabled for security.

I was able to solve the "not being able to log in because .ssh/authorized_keys" issue using this: https://stephen.rees-carter.net/thought/encrypted-home-directories-ssh-key-authentication. In summary:

sudo vim ~/.profile

and then entering

cd /home/username

But now, X11 forwarding over ssh is broken. It appears the MMC (MIT Magic Cookie) .Xauthority file is not making it into the un-encrypted home directory.


My initial thought is to modify ~/.profile to read:

cp /home/$USERNAME/.Xauthority /temp/$USERNAME
cd /home/username
mv /temp/$USERNAME/.Xauthority /home/$USERNAME

Where /temp is a directory that is owned by $USERNAME and has 700 permissions. I am not sure how secure this option is though.

| improve this answer | |
  • Aside from the lack of encryption, I don't see any security concerns with that. – joeytwiddle Sep 29 '16 at 3:41
  • For clarity, I would be tempted to use /home/$USERNAME.unencrypted/ instead of /temp/$USERNAME – joeytwiddle Sep 29 '16 at 3:41

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.