Take the 2-minute tour ×

I have a CentOS 6 server and I want to connect to it with a private key.

On Windows, I use PuTTY Keygen and paste the public key in my server, in .ssh/authorized_keys2 (also tried authorized_keys, don't remember why I'm using authorized_keys2).

Then, I save the private key "name.ppk" and use it with PuTTY (and pageant). Everything is ok until there. The connection is successful.

The problem comes when I try to connect from another Linux system.

I use the puttykeygen export option to export an OpenSSH key and use it from my other Linux system, but it doesn't work. It always says

Permission denied (publickey,gssapi-with-mic)

Also tried to create the key from the other Linux systems with:

ssh-keygen -t dsa

(and -t rsa) and pasted the public key on my CentOS server, where I want to connect. I've tried to paste it in both files (authorized_keys and authorized_keys2) but nothing works.

In fact, I've tried to connect from another real CentOS server, one CentOS virtual server on the same Windows 7 that can connect using PuTTY and one Debian virtual server on that same Windows 7.

The CentOS virtual server and Debian virtual server can connect to each other using keys.

Also, the config is different. Both virtual servers have the sshd_config as default, while the main CentOS 6 server has a config I've found years ago trying to do it safer, disabling the login without key, etc.

Here is my CentOS 6 config (without some comments):

Port xxxx
Protocol 2

SyslogFacility AUTHPRIV

PermitRootLogin yes
PasswordAuthentication no

ChallengeResponseAuthentication no

GSSAPIAuthentication yes
GSSAPICleanupCredentials yes

UsePAM no

X11Forwarding yes
UseDNS no

Subsystem   sftp    /usr/libexec/openssh/sftp-server
share|improve this question

migrated from stackoverflow.com Feb 3 '13 at 15:11

This question came from our site for professional and enthusiast programmers.

What permissions do the files have? Run ls -la in the .ssh directory to check. See my answer in stackoverflow.com/questions/14664723/… for the correct permissions. –  Edu Feb 3 '13 at 11:54
-rw-r--r-- If the permissions were wrong, do they work with putty? because I can connect with putty on windows, but can't with ssh on centos or debian –  user967636 Feb 3 '13 at 12:30
It's true that the client shouldn't matter with the permissions. Try connecting with ssh -v host to get debug output. You can give v parameter multiple times to be even more verbose. /var/log/auth.log may also help in deducing whatis wrong. –  Edu Feb 3 '13 at 14:19
I finally got it. The problem was that I use a name for each private key (as in windows) but ssh always tries to use only id_dsa key –  Noogic Feb 4 '13 at 14:08
Good that you found the problem. You can specify the key to be used with option -i. –  Edu Feb 4 '13 at 14:34

Your Answer



Browse other questions tagged or ask your own question.