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 18:05

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

查看更多
叼着烟拽天下
3楼-- · 2019-03-07 18:05

you need to check the configuration in sshd_config ListenAddress 0.0.0.0 update this and restart the sshd service that will resolve the issue.

查看更多
爷的心禁止访问
4楼-- · 2019-03-07 18:06

If you restart service then it will work

$ service sshd restart

then check

$ ssh localhost

It will work

查看更多
不美不萌又怎样
5楼-- · 2019-03-07 18:07

On mac go to system settings->network->sharing and allow remote login.

try ssh localhost

You should be good.

查看更多
爷、活的狠高调
6楼-- · 2019-03-07 18:07

For Linux:

  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
    
查看更多
forever°为你锁心
7楼-- · 2019-03-07 18:09

It might be caused by some of the following:

  1. SSH Server is not installed (only SSH Client), try: apt-get install ssh openssh-client openssh-server
  2. Connection is blocked by iptables (Firewall), try: ufw allow ssh
查看更多
登录 后发表回答