Advertisement
Advertisement


connect to host localhost port 22: Connection refused


Question

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 configuration data /etc/ssh/ssh_config    
debug1: Applying options for * 
debug2: ssh_connect: needpriv 0 
debug1: Connecting to localhost [127.0.0.1] port 22. 
debug1: connect to address 127.0.0.1 port 22: Connection refused 
ssh: connect to host localhost port 22: Connection refused

can some one help me to resolve this error , than changing port number

2014/01/19
1
82
1/19/2014 8:40:42 PM

Accepted Answer

My port number is different. i tried using

ssh localhost -p 8088

this worked for me

2014/01/19
1
1/19/2014 7:54:23 PM


  1. Remove SSH with the following command:

    sudo apt-get remove openssh-client openssh-server
    
  2. Install SSH again with:

    sudo apt-get install openssh-client openssh-server
    

It will solve your problem.

2018/03/11

Do you have sshd installed? You can verify that with:

which ssh
which sshd

For detailed information you can visit this link.

2018/03/11

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.

2018/03/11

Check if this port is open. Maybe your SSH demon is not running. See if sshd is running. If not, then start it.

2018/03/11

I did all the suggestion above and it did not work. Then I restart the ssh service and it works. This is what I do:

service ssh restart

Then I redo

ssh localhost

Now I can connect to my localhost. Hope it helps

2016/06/08