Cannot SSH into server with public key

Hello,

(My linode is running Ubuntu 9)

For the life of me I cannot figure out what's wrong with my public key. I have my public key in use with other sites, so my key should be okay.

I can SSH into my linode with password but not using publickey (ie, password auth turned off).

I have double and triple checked that my ~/.ssh/authorized_keys line is my correct key.

If I do an ssh -v I get:

...
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/xyz/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

Which seems just to say that it doesn't like my public and private key matching.

On the Linode server, I can do an "ssh localhost" with the key generated for my linode user account which seems to say, again, that it doesn't like my remote public key.

I turned on debug logging in sshd/config and when I connect all I get in the /var/log/auth.log is:

Sep 23 02:29:33 (none) sshd[1349]: Connection from x.y.w.z port 47100
Sep 23 02:29:33 (none) sshd[1349]: debug1: Client protocol version 2.0; client software version OpenSSH_5.2
Sep 23 02:29:33 (none) sshd[1349]: debug1: match: OpenSSH_5.2 pat OpenSSH*
Sep 23 02:29:33 (none) sshd[1349]: debug1: Enabling compatibility mode for protocol 2.0
Sep 23 02:29:33 (none) sshd[1349]: debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
Sep 23 02:29:33 (none) sshd[1349]: debug1: do_cleanup

The only thing that gives me some pause is that the name in my keyfile is MYNAME@host.local (it's a mac) but in some of the auth logs it says I'm connecting from a really long cpeipaddress.cable.host.com. I am assuming though this is fine since, again, my public key is in use other places.

Any help and tips on where to look is appreciated… I only have so much more hair to pull out. Thanks!

4 Replies

UPDATE:

It seems I had a bad config file in my local ~/.ssh/ folder. I discovered this when my 'working' remote site stopped accepting me, too!

However, now I'm back to my original issue tonight: getting git/gitosis to allow me to SSH in so I can clone repositories.

I may need to start another thread but in case any SSH gurus are also familiar with git, I get:

$ git clone git@xxx.linode.com:~/repositories/gitosis-admin.git
Initialized empty Git repository in /Users/xyz/Documents/Projects/misc/gitosis-admin/.git/
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
fetch-pack from 'git@xxx.linode.com:~/repositories/gitosis-admin.git' failed.

Since there seems to be some voodoo in posting on this forum and then things magically working an hour later…

I can now SSH in on my normal user name and get passed the publickey issue with git, also. I wish I knew what was wrong to help others that may have a similar issue. I will say that for SSHing in, I had to have the key in 'authorized_keys2'.

Now on git I'm getting a fatal: 'gitosis-admin.git': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly fetch-pack from 'git@xxx.members.linode.com:gitosis-admin.git' failed.
So if all goes according to my master plan, this should work in the morning! ;)

Something to check is the permissions on the file. This should be indicated in /var/log/messages, I believe. .ssh must be 755 and authorized_keys must be 644. If they're also more or less secure than that, sshd will refuse to use it, and will log an error.

Thanks for the reply.

I have all the permissions corrected. I did get past the previously mentioned step, though. My issue was, like with normal SSH, the 'git' user needed the authorizedkey files as 'authorizedkeys2'.

Now I'm just getting 'dont have write permissions' when trying to push a git repository to the server – one step at a time! :)

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