If I run ssh user@ (lets call that IP machine A) on machine B I can connect. I can also connect on machine C.

If I run it on another (machine D) I get Permission denied, please try again.

Why is this?

Note. I exit each session before trying the next. All computers are in the same network. (in fact all 4 are VMs on the same host) I am able to ping machine A from all machines. I am using password rather than key file. I am also able to connect to machine A from machine D (the opposite way round from what I want)

Edit: output from -vvv It seems it's authenticating properly but then being kicked off.

debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
jenkins@'s password: 
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to ([]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t3 r-1 i0/0 o0/0 fd 4/5 cc -1)

Connection to closed by remote host.
Connection to closed.
Transferred: sent 2084, received 2084 bytes, in 0.0 seconds
Bytes per second: sent 25409678.9, received 25409678.9
debug1: Exit status -1
  • 1
    what do you see when you add -vvvv to the ssh command? – man0v Feb 21 '18 at 17:26
  • did you forgot to exchange public keys ? – francois P Feb 21 '18 at 17:33
  • @man0v added the output of -vvv – Mark W Feb 21 '18 at 17:52
  • Do you have a shell assigned to your user? If using bash, is there anything that may be failing in .bash_profile or .bashrc? – man0v Feb 21 '18 at 17:58
  • I am using bash. These have not changed from their default (ubuntu 16) – Mark W Feb 22 '18 at 8:54

This error occurs when username/password is incorrect. Verify the password or change the password for user and try again. Verify if that user is there or not and it is having proper ownership and permission on his home location.

  • The username and password are correct. The same credentials work from machines B and C – Mark W Feb 22 '18 at 8:45

I discovered the problem.

There were two machines with the same IP.

It somehow happened that B and C connected to the correct one, and D was connecting to the wrong one

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.