Mac terminal 允许 root 用户通过 ssh 登录
默认情况下,Mac 的 root 用户是没有开启的,当然更不可能通过 ssh 登录了
开启 root 用户
官方开启 root 用户的说明
https://support.apple.com/zh-cn/HT204012
配置 sshd 允许 root 用户登录
# 1. 先进入 root 用户模式
su
# 2. 然后编辑 sshd_config 文件内容
vi /private/etc/ssh/sshd_config
# 3. 找到 ‘#PermitRootLogin prohibit-password’ 这一行,把前面的 # 号去掉,并把后面改成 yes
PermitRootLogin yes
# 4. 保存并退出
:wq!
重启 sshd 服务
launchctl stop com.openssh.sshd # 停止 ssh 服务
launchctl start com.openssh.sshd # 启动 ssh 服务