I am trying to get passwordless SSH authentication to work from a Windows 7 machine to local server.
-
Windows machine: My login name in this machine is
MY_LOGIN_NAME
. I am using Cygwin as the command line. -
CentOS 5.5 Server: I have admin privileges on this server; logged in as
root
.
Here is what I have done so far:
-
Logged into
MY_LOGIN_NAME
on the Windows machine, Issh-config-user
ed from the Cygwin command line. This created (at least) RSA public and private keys inC:/Users/MY_LOGIN_NAME/.ssh
-
I copied the public key over to the server to the
.ssh
directory usingscp
.scp id-rsa.pub root@xxx.xxx.xx.xx:.ssh/id-rsa.pub
-
Then I tried to log into the server using
ssh
like so:ssh -i id_rsa root@xxx.xxx.xx.xx
But it still asks me for my password. What am I missing?
Best Answer
The problem is your step 2. You overwrote root@xxx.xxx.xx.xx public key with your Cygwin public key. That's not what you want.
You should, instead, add your public key to root@xxx.xxx.xx.xx authorized keys. This can be done manually appending your id-rsa.pub to /root/.ssh/autorized_keys (on CentOS), or automagically running ssh-copy-id on Cygwin.
It will prompt for your password and then you should be fine.
Also, you should recover root@xxx.xxx.xx.xx public key, or generate a new pair, if it's not inconvenient.