"Server refused our key" error when setting up public/private keys [FIXED]

I've been following the linode guide on setting up my server, and I'm sadly stuck at the very beginning. I'm running a Windows desktop client, so I had to follow the rather unconventional ways of downloading and installing a few programs to create authorization keys. I copied the public key generated by PuttyGen into my ~/.ssh/authorized_keys and directed putty to the saved file on my computer, but no matter what I do, every time I restart putty and load the session to see if it works, it always says "Server refused our key" when I login under my user name. I also have no idea why the linode guide told me I needed to get WinSCP; I have not used it once.

I'm at my wits end, and about to reinstall the entire server OS again just to see if I messed something up in my 5 hours of attempting to fix this issue.

I am using CentOS 7 64 bit.

ls -l in /home/user/.ssh directory returns this:

total 16

-rw-rw-r– 1 user user 0 Sep 3 12:57 authorized_key

-rw-r--r-- 1 user user 397 Sep 3 13:48 authorized_keys

-rw------- 1 user user 1675 Sep 3 00:54 id_rsa

-rw-r--r-- 1 user user 392 Sep 3 00:54 id_rsa.pub

-rw-r--r-- 1 user user 175 Sep 3 12:41 known_hosts

authorized_keys contains the public key generated in PuttyGen. Putty has its SSH Auth private key directed at the saved .ppk on my Windows client.

Any help is appreciated.

7 Replies

The /home//.ssh directory needs to be chmoded to 700 and owned by user:user.

authorized_keys needs to be chmoded to 600 and owned by user:user

Thanks for the help, but it's still not working. My .ssh file permissions was 700, my authorized_keys somehow had gotten changed back, probably during one of the times I tried editing it.

ls -la ~ returns .ssh file as:

drwx–---- 2 user user 4096 Sep 3 13:48 .ssh

ls -l ~/.ssh returns authorized_keys as:

-rw–----- 1 user user 397 Sep 3 13:48 authorized_keys

Terminal in PuTTy still returns "Server refused our key."

Check out /var/log/secure or /var/log/auth.log - those might help diagnose.

@derfy:

Check out /var/log/secure or /var/log/auth.log - those might help diagnose.

Well. It's hard to find the information needed when there's 64,840 lines in the file. What should I exactly be looking for? Most of the lines just tell me about the failed logins. That brings up another question of why there were over 6k failed attempted logins today alone for root, with my computer asleep and myself at work, and this server is only 3 days old.

316 in the past 45 minutes or so. That's peculiar…

There are 6k failed attempts because its the internet. People scan everything and try to login.

Its been years since I've used putty but if I remember correctly putty uses a different format for public keys.

Make sure the public key you put in authorized_keys begins with 'ssh-rsa AAAA' ends with '==' and is all on one line.

@arlen:

There are 6k failed attempts because its the internet. People scan everything and try to login.

Its been years since I've used putty but if I remember correctly putty uses a different format for public keys.

Make sure the public key you put in authorized_keys begins with 'ssh-rsa AAAA' ends with '==' and is all on one line.

THANK YOU. That was the issue. The text they gave me to paste ended with "==rsa-keyxxxxx". Deleting that fixed it! And I figured so, but this is my first time being owner of a server, so it freaked me out a bit.

Awesome! \o/ :D let the fun begin!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct