2

When I attempt to ssh into my remote server, sometimes my terminal asks me for the username password, and sometimes it asks me for the ssh key passphrase. Is this normal? How can I have it always just ask for the ssh key passphrase?

I am using Gitbash with Windows. I am using a config file to specify the host.

My config file is setup as follows:

Host remoteservername
    Hostname serverbox.net
    User samplename
    IdentityFile ~/.ssh/id_rsa
    IdentitiesOnly yes

and then to ssh in I am doing:

ssh remoteservername

Sometimes I get back this:

samplename@remoteservername's password: 

Other times I get back what I want, the request for the passphrase:

Enter passphtase for key 'c/Users/name/.ssh/id_rsa'

The username password is long and complex, so I would ideally like to always just use the ssh key.

The current setup works, except for when it randomly asks for the username password instead of the key phrase.

UPDATE:

As per VonC I ran ssh -Tvv and compared the logs of a successful return versus an incorrect return. Most of the logs were identical until the very end. The attempt that resulted in asking for the username password had these lines:

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
samplename@serverbox.net's password:

the correct response returns these lines instead:

debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
debug2: input_userauth_pk_ok: fp SHA256:{KEY HERE}
Enter passphrase for key '/c/Users/name/.ssh/id_rsa':

Is this possibly something wrong with my ssh itself? Or could it be a configuration issue on the server?

Paul Matos
  • 169
  • 1
  • 13
  • Possible duplicate of [we did not send a packet, disable method](https://stackoverflow.com/questions/47875126/we-did-not-send-a-packet-disable-method) – tripleee May 13 '19 at 09:22

1 Answers1

1

Try an ssh -Tvv remoteservername multiple times to see if there is any difference between a successful session and one where it defaults back to the user password.

Double-check your PATH and see if the issue persists within a session launched with a simplified PATH (as in here)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tried setting the simplified path but the issue persisted. The logs were mostly identical until the very end. I have edited post with output. – Paul Matos May 08 '19 at 17:13
  • @PaulMatos "Or could it be a configuration issue on the server?": for that, make sure sshd is launched with a debug option, and check the logs on the server side when you initiate an SSH session: https://stackoverflow.com/a/41844152/6309 – VonC May 08 '19 at 20:01