0

After installing two VMs in VirtualBox, I tried to connect them, using ssh protocol from the client machine (with openssh-client installed) to the ssh server machine (with openssh-server installed). Both of machines are in a Host Only Network (named: vboxnet0). When I try, from the client (named: sshclient), to open a ssh connection on the server (named: sshserver and with IP address:192.168.56.3), I get the message: Permission denied, please try again. I typed:ssh sshclient@sshserver -p 22 and typed the password (correctly, I am sure) 3 times. The port 22 was enabled on the server configuration file /etc/ssh/sshd_config, the PasswordAuthentication line was uncommented and the IP address of the client was added in the file /etc/hostson server side.

What is happened? Any tips to solve?

Thanks a lot.

1

Since the client is unable to even attempt to connect to the server try netstat -tln on the server. It sounds like it doesn't have port 22 open for some reason.

If :22 isn't listed then try restarting the ssh service.

Also when attempting to connect to a server via ssh the user portion (before the '@' needs to be a user that is on the server. It sounds like you are trying to use the user from the sshClient to login to the sshServer, when in reality this doesn't make sense.

For example: Let us say that The sshServer has a user ExtraUser and the sshClient has a user Karen. If Karen wants to ssh into the server she will need to type ssh ExtraUser@sshServer. This will have her login to the sshServer as ExtraUser, not as Karen. This is important because Karen's user account/permissions is located on the sshClient not the sshServer.

  • 1) The output of that command is here: [link]pastebin.com/t3EUsMYn 2) So, you mean that the correct typing is: ssh -v sshserver@sshserver in my case? – michele_ub May 1 '18 at 14:24
  • I think that I should let the server know the user on my client machine before. How to do that? – michele_ub May 1 '18 at 14:35
  • Checking better the output of netstat -tln, port :22 is about a tcp connection 6, tcp over ip version 6. Could be this the problem? – michele_ub May 1 '18 at 15:07
  • @michele_ub The output of your netstat looks good to me. After the ssh part of the command the next part is the username of an existing user on the sshServer. So ssh user-on-sshServer@sshserver should work. Though to be safe it would be best to use the ip address of the sshServer instead sshserver. Something like ssh user-on-sshServer@192.168.1.10 or whatever the ip of that machine is on your virtual network. – Rohlex32 May 1 '18 at 15:45
  • 1
    @michele_ub You just need to use the same user to login to the sshServer as you would normally. Once you do that it should work. Please mark this question as answered – Rohlex32 May 1 '18 at 18:52

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.