connect to host localhost port 22: Connection refused

前端 未结 28 2216
误落风尘
误落风尘 2021-01-29 19:01

While installing hadoop in my local machine , i got following error

ssh -vvv localhost 
OpenSSH_5.5p1, OpenSSL 1.0.0e-fips 6 Sep 2011 
debug1: Reading configura         


        
相关标签:
28条回答
  • 2021-01-29 19:26

    For what its worth I got the following error trying to ssh into my local machine, running Ubuntu 16.04 Xenial, from a vm.

     ssh: connect to host 192.168.144.18 port 22: Connection refused
    

    It got immediately fixed with:

    sudo apt-get install ssh
    

    Take note, Before fix: 'which sshd' returned nothing and 'which ssh' returned

    /usr/bin/ssh
    

    And After the fix: 'which sshd' returned

    /usr/sbin/sshd
    
    0 讨论(0)
  • 2021-01-29 19:26

    What worked for me is:

    sudo mkdir /var/run/sshd
    sudo apt-get install --reinstall openssh-server
    

    I tried all the above mentioned solutions but somehow this directory /var/run/sshd was still missing for me. I have Ubuntu 16.04.4 LTS. Hope my answer helps if someone has the same issue. ubuntu sshxenial

    0 讨论(0)
  • 2021-01-29 19:28

    Try installing whole SSH package pack:

    sudo apt-get install ssh
    

    I had ssh command on my Ubuntu but got the error as you have. After full installation all was resolved.

    0 讨论(0)
  • 2021-01-29 19:28

    I use a Mac, this worked for me:

    Open System Preferences, then search for 'sharing'.

    Choose Remote Login, make sure it is on and remember to add required users.

    Got it from here

    0 讨论(0)
  • 2021-01-29 19:28

    try sudo vi /etc/ssh/sshd_config

    in first few lies you'll find

    Package generated configuration file

    See the sshd_config(5) manpage for details

    What ports, IPs and protocols we listen for

    Port xxxxx

    change Port xxxxx to "Port 22" and exit vi by saving changes.

    restart ssh sudo service ssh restart

    0 讨论(0)
  • 2021-01-29 19:28

    if you are able to ping and not able to ssh, then it is a firewall. The firewall on 18.4 (not sure about other versions) in on by default and only allow port 8080.

    Here how you fix it

    https://linuxconfig.org/how-to-enable-disable-firewall-on-ubuntu-18-04-bionic-beaver-linux

    0 讨论(0)
提交回复
热议问题