Forum: 

Private Key Being Passed As Public Key

Nick Bates's picture

Hi. I am trying to set up a shell script to sftp a file from one linux server to another. Server A to Server B.

I have generated the public and private key files using ssh-keygen -t rsa on Server A and have copied the public key file contents onto server B at ~/.ssh/authorized_keys, set it to chmod 600.  When i'm attempting the transfer, I'm still getting prompted for the password.  I have set the verbose option on the sftp command, and from whaty I can see, it is attempting to send the private key as a public key to server B.  Here is an excerpt...

.....

debug1: Authentications that can continue: publickey,password

debug1: Next authentication method: publickey

debug1: Offering public key: /home/<user>/.ssh/id_rsa

debug1: Authentications that can continue: publickey,password

debug1: Offering public key: /home/<user>/.ssh/id_dsa

debug1: Authentications that can continue: publickey,password

debug1: Next authentication method: password

<user@serverB>'s password:

It looks as if it's trying to pass the private key file as the public key.  Can you tell me how to configure it to pass the public key file ?  Or, any other pointers as to how to correct this ?

Thank you, Nick.

Post new comment