Public Key not working with user@server but does work with root@server

Aug 23rd, 2010 | By | Category: Technology

Weirdest thing about my FreeBSD server that’s been bugging me for a long time.. I’m able to create rsa/dsa keys for passwordless logins but the catch was that it would only work if I was root on the client machine loggin in as root on the server.  After 6 hours of trouble shooting and mostly relying on the geniuses over at #freebsdhelp on efnet, running sshd in debug mode, running ssh in -vvv mode it came down to a stupid little error in the /etc/ssh/sshd_config file.

The line in question was:

AuthorizedKeysFile      ~/.ssh/authorized_keys2

and whoever set it up originally bunged it up because it needs to be

AuthorizedKeysFile      %h/.ssh/authorized_keys2

to work properly or else sshd will always refer to /root/.ssh/authorized_keys2 no matter who’s loggin in..

Hopefully this will help someone else save the nearly full work day of time to narrow this mother trucker down

Tags: , , , , , , , , , , ,

Leave a Comment