![](/img/trans.png)
[英]ssh failed when installing hadoop:connect to host master port 22: connection refused
[英]connect to host localhost port 22: Connection refused
在我的本地机器上安装 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
有人可以帮我解决这个错误,而不是更改端口号
如果在 Mac OSX 上安装 Hadoop,请确保在System Preferences下打开Remote Login然后File Sharing 。 这在我的机器上有效。
使用以下命令删除 SSH:
sudo apt-get remove openssh-client openssh-server
再次安装 SSH:
sudo apt-get install openssh-client openssh-server
它会解决你的问题。
尝试安装整个 SSH 软件包:
sudo apt-get install ssh
我在我的 Ubuntu 上有ssh
命令,但和你一样得到了错误。 完全安装后,一切都解决了。
检查此端口是否打开。 也许您的 SSH 恶魔没有运行。 查看 sshd 是否正在运行。 如果没有,那就开始吧。
我做了上面的所有建议,但没有奏效。 然后我重新启动 ssh 服务,它工作正常。 这就是我所做的:
service ssh restart
然后我重做
ssh localhost
现在我可以连接到我的本地主机。 希望能帮助到你
如果您重新启动服务,它将起作用
$ service sshd restart
然后检查
$ ssh localhost
它会工作
确保 /etc/hosts.allow 包含:
ssh:ALL:allow
sshd:ALL:allow
或者
ssh:localhost:allow
sshd:localhost:allow
或 - 其他一些变体
ssh:{host1,host2,host3...}:allow
sshd{host1,host2,host3...}:allow
确保文件中的第一行不以 ALL:ALL:DENY 开头
没有任何东西能够与主机通信……在任何端口上。
我用了:
sudo service ssh start
然后:
ssh localhost
对于我的情况(ubuntu 14.04,全新安装),我只需运行以下命令即可!
sudo apt-get install ssh
对于它的价值,我尝试从虚拟机通过 ssh 连接到运行 Ubuntu 16.04 Xenial 的本地机器时出现以下错误。
ssh: connect to host 192.168.144.18 port 22: Connection refused
它立即得到修复:
sudo apt-get install ssh
请注意,修复之前:'which sshd' 没有返回任何内容,而 'which ssh' 返回
/usr/bin/ssh
修复后:'which sshd' 返回
/usr/sbin/sshd
它可能是由以下一些原因引起的:
apt-get install ssh openssh-client openssh-server
ufw allow ssh
在 Mac 上,转到系统设置->网络->共享并允许远程登录。
尝试 ssh 本地主机
你应该很好。
sudo systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor prese>
Active: inactive (dead)
Docs: man:sshd(8)
man:sshd_config(5)
sudo systemctl enable sshd
sudo systemctl start sshd
我的端口号不同。 我尝试使用
ssh localhost -p 8088
这对我有用
如果您仍然遇到问题,请尝试以下操作:
sudo ufw enable
sudo apt-get install openssh-server
这也可能有效。
实际上我解决了这个问题,我刚刚安装了 shh 守护进程。
在终端:
须藤 apt-get 安装 openssh-server
一种方法是去终端
$ sudo gedit /etc/hosts
***enter your ip address ipaddress of your pc localhost
ipaddress of your pc localhost(Edit your pc name with localhost) **
并再次使用以下命令重新启动您的 ssh 服务:
$ service ssh restart
问题将得到解决。 谢谢
如果您使用的是centOS 或Red Hat,您应该首先更新SElinux。 执行以下语句
ausearch -c 'sshd' --raw | audit2allow -M my-sshd
那么你需要执行
semodule -i my-sshd.pp
祝你好运
如果您确定已经安装了 ssh,那么ssh
和/或sshd
可能已终止或服务器服务尚未启动。 要检查这些进程是否正在运行,请使用:
//this tells you whether your ssh instance is active/inactive
sudo service ssh status
或者
//this list all running processes whose names contain the string "ssh"
sudo ps -A | grep ssh
ssh
很可能会处于活动状态并正在运行,但sshd
不会。 要启用它们:
sudo service ssh start
注意; - 一些系统有重启选项,但我的没有
试试sudo vi /etc/ssh/sshd_config
在最初的几个谎言中你会发现
打包生成的配置文件
有关详细信息,请参阅 sshd_config(5) 联机帮助页
我们侦听哪些端口、IP 和协议
端口xxxxx
将端口 xxxxx 更改为“端口 22”并通过保存更改退出 vi。
重新启动 ssh sudo service ssh restart
您可能应该编辑您的/etc/hosts
。 例如,如果我的hostname
是ub0
,但hostname
在/etc/hosts
的localhost
,就可能发生
connect to host ub0 port 22: Connection refused
由于hostname
在/etc/hosts
的localhost
不ub0
。
因此,在构建分布式集群时应该注意hostname
。
对于 Linux:
使用以下命令删除 SSH:
sudo apt-get remove openssh-client openssh-server
再次安装 SSH:
sudo apt-get install openssh-client openssh-server
您需要检查 sshd_config ListenAddress 0.0.0.0 中的配置更新此并重新启动将解决问题的 sshd 服务。
如果您可以 ping 而不能 ssh,则它是防火墙。 18.4 上的防火墙(不确定其他版本)默认开启,只允许端口 8080。
在这里你如何修复它
https://linuxconfig.org/how-to-enable-disable-firewall-on-ubuntu-18-04-bionic-beaver-linux
检查文件 /etc/ssh/sshd_config 的端口号。 确保它是 22。
对我有用的是将 ssh 配置文件修改为以下内容:
Host * AddKeysToAgent 是 UseKeychain 是 IdentityFile ~/.ssh/id_rsa
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.