Linode Forum Index Linode Forum
Linode Community Forums
 


Cannot SSH into server with public key

Click here to go to the original topic

 
       Linode Forum Index -> General Discussion
Author Message
Richard



Joined: 29 Jun 2009
Posts: 9

Posted: Tue Sep 22, 2009 9:34 pm    Post subject: 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:
Code: ...
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:
Code: 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 cpe_ip_address.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!
Back to top  
Richard



Joined: 29 Jun 2009
Posts: 9

Posted: Tue Sep 22, 2009 10:25 pm    Post subject:  

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:
Code: $ 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.
Back to top  
Richard



Joined: 29 Jun 2009
Posts: 9

Posted: Wed Sep 23, 2009 12:34 am    Post subject:  

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 Code: 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! ;)
Back to top  
BarkerJr



Joined: 02 Aug 2009
Posts: 220
Location: Connecticut, USA

Posted: Wed Sep 23, 2009 7:08 am    Post subject:  

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.
Back to top  
Richard



Joined: 29 Jun 2009
Posts: 9

Posted: Wed Sep 23, 2009 10:17 am    Post subject:  

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 authorized_key files as 'authorized_keys2'.

Now I'm just getting 'dont have write permissions' when trying to push a git repository to the server -- one step at a time! :)
Back to top  
 
       Linode Forum Index -> General Discussion
Page 1 of 1