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