Linux 连接到主机 localhost 端口 22:连接被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17335728/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
connect to host localhost port 22: Connection refused
提问by Surya
While installing hadoop in my local machine , i got following error
在我的本地机器上安装 hadoop 时,出现以下错误
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
有人可以帮我解决这个错误,而不是更改端口号
采纳答案by Surya
My port number is different. i tried using
我的端口号不同。我尝试使用
ssh localhost -p 8088
this worked for me
这对我有用
回答by abhinav
Check if this port is open. Maybe your SSH demon is not running. See if sshd is running. If not, then start it.
检查此端口是否打开。也许您的 SSH 恶魔没有运行。查看 sshd 是否正在运行。如果没有,那就开始吧。
回答by Tariq
回答by Larry Helms
Make sure that /etc/hosts.allow contains:
确保 /etc/hosts.allow 包含:
ssh:ALL:allow
sshd:ALL:allow
OR
或者
ssh:localhost:allow
sshd:localhost:allow
OR - some other variant
或 - 其他一些变体
ssh:{host1,host2,host3...}:allow
sshd{host1,host2,host3...}:allow
INSURE that the first line in the file DOES NOT begin with ALL:ALL:DENY
确保文件中的第一行不以 ALL:ALL:DENY 开头
NOTHING will be able to communicate with the host... on any port.
没有任何东西能够与主机通信……在任何端口上。
回答by vladof81
If install Hadoop on Mac OSX, make sure turn on Remote Loginunder System Preferencesthen File Sharing. This worked on my machine.
如果在 Mac OSX 上安装 Hadoop,请确保在System Preferences下打开Remote Login然后File Sharing。这在我的机器上有效。
回答by Divyang Shah
Remove SSH with the following command:
sudo apt-get remove openssh-client openssh-server
Install SSH again with:
sudo apt-get install openssh-client openssh-server
使用以下命令删除 SSH:
sudo apt-get remove openssh-client openssh-server
再次安装 SSH:
sudo apt-get install openssh-client openssh-server
It will solve your problem.
它会解决你的问题。
回答by Michael Z
Try installing whole SSH package pack:
尝试安装整个 SSH 软件包:
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.
我ssh
在我的 Ubuntu 上有命令,但和你一样得到了错误。完全安装后一切都解决了。
回答by Dinesh
If you still face problems, try the following:
如果您仍然遇到问题,请尝试以下操作:
sudo ufw enable
sudo apt-get install openssh-server
This might work too.
这也可能有效。
回答by GoingMyWay
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
您可能应该编辑您的/etc/hosts
. 例如,如果 myhostname
是ub0
,但hostname
in/etc/hosts
是localhost
,则可能会发生
connect to host ub0 port 22: Connection refused
Because the hostname
in /etc/hosts
is localhost
not ub0
.
因为hostname
在/etc/hosts
是localhost
没有ub0
。
So, you should be careful the hostname
when building up distributed clusters.
因此,hostname
在构建分布式集群时应该小心。
回答by Shiqing Fan
For my case(ubuntu 14.04, fresh installed), I just run the following command and it works!
对于我的情况(ubuntu 14.04,全新安装),我只需运行以下命令即可!
sudo apt-get install ssh
sudo apt-get install ssh