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

执行 ssh root@47.94.142.215

报错

首先要开启ssh

系统偏好设置-共享

选上远程登陆

选上远程管理

检测openssh-server是否安装成功 ,安装成功的如下

ps -e | grep ssh

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

原文地址:https://www.cnblogs.com/wang715100018066/p/10694077.html