天天看點

ssh: connect to host xx.xx.xxx.xxx port 22: Connection refused

執行 ssh [email protected]

報錯

ssh: connect to host xx.xx.xxx.xxx port 22: Connection refused

首先要開啟ssh

系統偏好設定-共享

選上遠端登陸

ssh: connect to host xx.xx.xxx.xxx port 22: Connection refused

選上遠端管理

ssh: connect to host xx.xx.xxx.xxx port 22: Connection refused

檢測openssh-server是否安裝成功 ,安裝成功的如下

ps -e | grep ssh      
ssh: connect to host xx.xx.xxx.xxx port 22: Connection refused

mac本身安裝了ssh服務,預設情況下不會開機自啟

1.啟動sshd服務:

sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

2.停止sshd服務:

sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist

檢查是否啟動ssh,啟動了的 如下

sudo launchctl list | grep ssh      
ssh: connect to host xx.xx.xxx.xxx port 22: Connection refused

轉載于:https://www.cnblogs.com/wang715100018066/p/10694077.html