![](/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.