ssh: connect to host 10.0.2.15 port 22: Connection refused

35,763

Use ssh with port option:

ssh [email protected] -p 2222

Edit

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)

Share:
35,763

Related videos on Youtube

ebatinstitute
Author by

ebatinstitute

Updated on September 18, 2022

Comments

  • ebatinstitute
    ebatinstitute over 1 year

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

    ssh [email protected]
    

    But I keep in getting this response :

    ssh: connect to host 10.0.2.15 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"

    • pa4080
      pa4080 over 7 years
      Please edit your question and show us the content of etc/ssh/sshd_config.
  • ebatinstitute
    ebatinstitute over 7 years
    I have one question ,why do you put -p 2222?
  • Ghasem Pahlavan
    Ghasem Pahlavan over 7 years
    because your ssh server have listened on port 2222 but you connect to port 22.
  • Ghasem Pahlavan
    Ghasem Pahlavan over 7 years
    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