connect to host localhost port 22: Connection refu

2019-03-07 17:25发布

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

标签: linux hadoop ssh
24条回答
神经病院院长
2楼-- · 2019-03-07 17:42

If install Hadoop on Mac OSX, make sure turn on Remote Login under System Preferences then File Sharing. This worked on my machine.

Remote Login

查看更多
Fickle 薄情
3楼-- · 2019-03-07 17:42

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

查看更多
▲ chillily
4楼-- · 2019-03-07 17:43

If you're certain that you have installed ssh, then it's possible that ssh and/or sshd has been terminated or the server service hasn't been started. To check whether these processes are running use:

//this tells you whether your ssh instance is active/inactive
sudo service ssh status

OR

//this list all running processes whose names contain the string "ssh"
sudo ps -A | grep ssh

It's likely that ssh would be active and running but sshd would not. To enable them:

sudo service ssh start

NB; - some systems have a restart option but mine didn't

查看更多
做自己的国王
5楼-- · 2019-03-07 17:48

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
查看更多
不美不萌又怎样
6楼-- · 2019-03-07 17:48

My port number is different. i tried using

ssh localhost -p 8088

this worked for me

查看更多
Root(大扎)
7楼-- · 2019-03-07 17:48

You may should edit your /etc/hosts. For example if my hostname is ub0, but the hostname in /etc/hosts is localhost, it may occur

connect to host ub0 port 22: Connection refused

Because the hostname in /etc/hosts is localhost not ub0.

So, you should be careful the hostname when building up distributed clusters.

查看更多
登录 后发表回答