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:49

A way to do is to go to terminal

$ sudo gedit /etc/hosts

***enter your ip address ipaddress of your pc  localhost 
    ipaddress of your pc  localhost(Edit your pc name with localhost) **

and again restart your ssh service using:

$ service ssh restart

Problem will be resolve. Thanks

查看更多
成全新的幸福
3楼-- · 2019-03-07 17:51

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.

查看更多
来,给爷笑一个
4楼-- · 2019-03-07 17:52

For my case(ubuntu 14.04, fresh installed), I just run the following command and it works!

sudo apt-get install ssh

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

if you are using centOS or Red Hat, you should first update SElinux. Execute the following statement

ausearch -c 'sshd' --raw | audit2allow -M my-sshd

then you need to execute

semodule -i my-sshd.pp

good luck

查看更多
成全新的幸福
6楼-- · 2019-03-07 17:53

Actually i solved this, I just installed shh daemon.

in terminal :

sudo apt-get install openssh-server

查看更多
姐就是有狂的资本
7楼-- · 2019-03-07 17:57
  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.

查看更多
登录 后发表回答