I have two VMs running Ubuntu server 16.04 on the same host machine, let us call them A and B. They have different MAC addresses, which are both allowed on the network and can both access the Internet. I can use putty to ssh into both VMs. I can use B to ssh into A. However, I cannot use A to ssh into B, since I consistently get a "permission denied (password)" error. It doesn't even get to the point where it asks me to enter my username. The command I am running is:

ssh -p 6600 MY_IP

where I've added port forwarding from port 6600 to port 22, on which B listens to incoming ssh requests. Since putty can ssh into B, I assume this isn't an ssh setting issue.

Any ideas? I have installed openssh and I believe that's what I'm using.

  • Do you use the exact same username on both machines? If not, you'll need to specify which user you're logging in as (you must log in as a user that exists on the remote machine). For example, if the remote machine has a user named "bob", you can ssh -p 6600 bob@MY_IP Jul 13 '16 at 14:16
  • They are identical, yes, and using userB@MY_IP in the command results in the same error. Also, creating a new user on B doesn't help. And remember, I can still log in with putty, which is what is so weird Jul 13 '16 at 14:16

It turns out that the problem was with A's ssh_config file. It had PasswordAuthentication set to "no", with all other authentication methods commented out (which I believe means they are set to default?)


You have used command incorrectly.

ssh username@ip

The error also may occur if you have enabled password less authentication and disabled password authentication in ssh_config file.

As mentioned in the comments it may be because of error in config file.

  • As per the answer above, the problem was with ssh_config having password authentication disabled. Jul 14 '16 at 18:06

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.