0

I am trying to login from serverA to serverB using bash .

I'm using this way

ssh -p 26522 -i /usr/mykey_dsa.pub root@serverB

After pressing return, I receive this

Enter passphrase for key '/usr/mykey_dsa.pub':

I enter the passphrase which I am sure is 100% correct but it's not accepted. Why the passphrase is not accepted ?

I can login in serverB using that key mykey_dsa.pub using any Windows SSL client (ZOC e.g.) and the passphrase is accepted , so what's wrong connecting from bash ssh ?.

5
  • 1
    what are the access rights on your key? And what if you do: ssh-add /usr/mykey_dsa. And by the way, you should you the private key to login, not the .pub
    – darxmurf
    Jun 4 '20 at 7:11
  • -rw------- 1 root root 589 Jun 3 12:00 /usr/mykey_dsa.pub
    – gr68
    Jun 4 '20 at 7:14
  • Could not open a connection to your authentication agent.
    – gr68
    Jun 4 '20 at 7:14
  • 1
    You need the private key to authenticate via SSH, not the .pub
    – darxmurf
    Jun 4 '20 at 7:15
  • ok :( , sorry shame on me
    – gr68
    Jun 4 '20 at 7:17
1

The name mykey_dsa.pub suggests it contains the public half of the key pair. You're supposed to place that into the ~/.ssh/authorized_keys file on the server, and use the private half of the key pair at the SSH client to authenticate.

But if you know that key file works on other clients, the *.pub file probably actually contains the private half of the key despite the misleading name. In that case, read on...

If the key file is imported from Windows, it may be using Windows-style line endings (CR+LF) while Linux and other Unix-style systems use a different style (LF only). Some versions of OpenSSH are known to react badly to Windows-style line endings in key files, and won't produce an error message that would identify the problem for you.

You could use commands dos2unix or fromdos to convert the line endings to proper style.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.