Over a million developers have joined DZone.
Platinum Partner

Tried Everything and SSH with PKA Still Not Working?

· DevOps Zone

The DevOps Zone is brought to you in partnership with New Relic.  Download 5 Unsung Tools of DevOps to see which tools make the cut and why.

I recently ran into the situation in which I couldn’t get PKA to work when SSHing into my Ubuntu server. I checked the key pair (works fine SSHing into other servers), directory permissions, /etc/ssh/sshd_config, /var/log/auth.log, all that. Ran ssh -vvv but nothing obvious other than the server wasn’t accepting my PKA authentication. I’m not a systems guy, but I’ve set this up often enough that I couldn’t figure out for the life of me why it kept going for password authentication.

Finally found the answer: my home directory is encrypted. SSH can’t read the ~/.ssh/authorized_keys file until I log in, so it rejects the PKA auth and goes to password.

The solution is to place the authorized_keys file in an alternative location (e.g., /etc/ssh/<username>/authorized_keys), reconfigure sshd_config to use that location, set permissions, and restart the SSHD server. It’s here, under Troubleshooting.

Hope that helps somebody out. It was driving me bonkers.

The DevOps Zone is brought to you in partnership with New Relic.  Read about where DevOps started and how the adoption rate went from tiny startups to giant Fortune 500 enterprises.

Topics:

Published at DZone with permission of Willie Wheeler , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}