DirtyMonkey All American 4269 Posts user info edit post |
i'm trying to set up ssh to allow me to login as myself (let's say my username is fred). currently there is a public key in /root/.ssh/authorized_keys that works, but i login as root with fred's password. it's kind of weird. what i want is to have /home/fred/.ssh/authorized_keys to have a pubic key for logging in as fred, but the remote server seems to be flat out ignorning that file. i've tried creating the keys with puttygen on my local computer, and also creating the keys on the remote server. i also did remember to reload the service after making changes.
i keep getting:
Using username "fred" "Server refused our key"
do i have to do something special to get sshd to look into the specified user's authorized_keys file? 4/15/2008 2:57:44 PM |
mellocj All American 1872 Posts user info edit post |
The most common problem is permissions on the user's .ssh folder. ~fred/.ssh needs to be owned by fred and chmodded 700, won't work any other way. 4/15/2008 3:16:18 PM |
DirtyMonkey All American 4269 Posts user info edit post |
thanks for the reply.
fred's folder is 700, and authorized_keys is 600. 4/15/2008 3:18:02 PM |
Shaggy All American 17820 Posts user info edit post |
check your sshd config to see what it has set for the default authorized keys file. 4/15/2008 3:19:22 PM |
DirtyMonkey All American 4269 Posts user info edit post |
#AuthorizedKeysFile .ssh/authorized_keys
it is, obviously, commented out. i tried uncommenting and changed it to:
AuthorizedKeysFile %h/.ssh/authorized_keys
but that didn't work either. fwiw, UsePam is set to Yes. I don't know anything about that though. 4/15/2008 3:23:23 PM |
Shaggy All American 17820 Posts user info edit post |
if its commented out iirc it should go to the default which is userhome/.ssh/Authorized_Keys as you already know.
I think its commented out by default too. I would double check how you're putting it into the authed keys file. If you put the public key into root's authorized_keys file and then try to login with they key as root, does it work? 4/15/2008 3:33:42 PM |
DoeoJ has 7062 Posts user info edit post |
do you need the %h? 4/15/2008 3:33:47 PM |
DirtyMonkey All American 4269 Posts user info edit post |
^ i've tried it with and without it.
^^ i copied the public key into root's authorized_keys file and tried to connect as root. it worked perfectly. so does this mean that there is something wrong with fred's authorized_keys file or does it mean that sshd isn't even looking into it? 4/15/2008 3:43:47 PM |
Shaggy All American 17820 Posts user info edit post |
My first guess would be that sshd isn't looking at it for some reasons (either permissions or config).
Try matching the permissons with root's .ssh dir and everything inside it 4/15/2008 3:55:18 PM |
DirtyMonkey All American 4269 Posts user info edit post |
you are not going to believe what the problem was...
original file:
ssh-rsa %mybiglongkey%== comment
new file:
ssh-rsa %mybiglongkey%=
WTF? comments work fine in the root file. i did not expect that to fix it, yet i am not at all surprised. anyway, it works so i will stop while i'm ahead. thanks very much for everyone's help.
[Edited on April 15, 2008 at 4:04 PM. Reason : &]4/15/2008 4:04:05 PM |