Mac terminal 允许root用户通过ssh登录

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 服务

现在可以以 root 身份正常 ssh 登录 mac 了

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

十月ooOO

许个愿,我帮你实现

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值