I have been trying the following command on the virtual machine in Ubuntu:

ssh root@

But I keep in getting this response :

ssh: connect to host port 22: Connection refused

I have checked my ssh status with this command :

service sshd status

And I got this result back:

Screenshot showing, among other information, "Server listening on :: port 22"

  • Please edit your question and show us the content of etc/ssh/sshd_config.
    – pa4080
    Jan 22 '17 at 14:59

Use ssh with port option:

ssh root@ -p 2222


This issue happens when you change your ssh server port to a non standard port like 2222 in ssh config file. (/etc/ssh/sshd_config --> Port 2222)

  • I have one question ,why do you put -p 2222? Jan 22 '17 at 15:12
  • 4
    because your ssh server have listened on port 2222 but you connect to port 22. Jan 22 '17 at 15:15
  • you can change your ssh server listening port in this file: /etc/sshd/sshd_config ---> Port 22 and after that restart your ssh service. systemctl restart ssh Jan 22 '17 at 15:17

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.