This question already has an answer here:

I'm currently running Ubuntu in a VMworkstation Pro, when I try to SSH into it, the connection is rejected. But, I can ping Ubuntu IP successfully.

marked as duplicate by user68186, David Foerster, karel, George Udosen, Zanna Jan 7 '18 at 20:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • ssh -v theServer will show more information. – waltinator Jan 6 '18 at 22:46
  • have you enabled openssh-server? (sshd) a default install sets up ssh only for outgoing, not incoming. – guiverc Jan 6 '18 at 22:57
  • No not specifically. I'm new to all of this. How do I check or start the openssh server. – ClydeB Jan 6 '18 at 23:07
  • I'm using Putty from my Windows 10 laptop to ssh to the Ububtu VM. – ClydeB Jan 6 '18 at 23:08
  • sudo apt install openssh-server ssh on Ubuntu largely refers to the client software which allows you ssh TO another box. sshd/openssh-server is the system daemon or server part of it which allows ssh INTO the box. (specifying version of Ubuntu may help - my answer is consequentially generic) – guiverc Jan 6 '18 at 23:20

You need to start and enable (so that it runs on system startup) the SSH server:

sudo systemctl enable ssh.service
sudo systemctl start ssh.service
  • I got it working. Needed to install the package. Thx for the help. – ClydeB Jan 6 '18 at 23:31
  • 1
    @ClydeB If this answer helped you, please check the mark (left hand column) and accept the answer. – Charles Green Jan 7 '18 at 0:40

You first need to install openssh-server package using the following command:

sudo apt install openssh-server -y

Make sure to activate the service and check if it really is:

sudo systemctl start ssh
sudo systemctl status ssh

To be sure that it is enabled at boot, execute the following command:

sudo systemctl enable ssh

If you are trying to connect from a Windows 10 machine, then Microsoft SSH may be getting in the way. You need to change the port in /etc/ssh/ssh_config in the VM to something other than 22. For example, if you choose 2222, then you would tell putty to also connect to port 2222.

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