SSH Permission denied (publickey).

Standard

I have a home server that I use to play with Linux. At the moment, I’m exploring Docker.

When you try to SSH into your home server you may get the following error message if you have an encrypted home directory, you use SSH keys, and you haven’t actually logged into the server machine yet:

Permission denied (publickey).

The problem is due to the fact that your home folder is encrypted and your authorized_keys file is inside it. The solution is to move your authorized_keys file into a separate /etc/ssh/<username>/ folder where <username> is the name of the user that you are logging in as. Use the following commands to set this up:

sudo bash
export username=<username> (replace <username> with your Linux user name)
cd /etc/ssh
mkdir $username
chmod 755 $username
chown $username:root $username
mv /home/$username/.ssh/authorized_keys $username
chmod 644 $username/authorized_keys
chown $username:root $username/authorized_keys

Note: For good measure, I’ve removed my ~/.ssh folder as I wasn’t using it for anything else.

Then edit your /etc/ssh/sshd_config and add:

AuthorizedKeysFile /etc/ssh/%u/authorized_keys

Finally, restart ssh with:

service ssh restart

The next time you connect with SSH you should not have to enter your password and no more permission denied messages.

Based on Ubuntu SSH troubleshooting article.
Advertisements

Chrome extensions not working

Standard

All my Chrome (Version 48.0.2564.116 m) extensions suddenly stopped working the other day. To recover remove your profile in settings. My profile is sync’ed to Google, so I can add it back later. With no profile selected add some random extension (I picked Postman as it is my favorite rest client), then log back in and lo and behold extensions are working again 🙂