天天看點

Mac terminal 允許root使用者通過ssh登入

Mac terminal 允許 root 使用者通過 ssh 登入

預設情況下,Mac 的 root 使用者是沒有開啟的,當然更不可能通過 ssh 登入了

開啟 root 使用者

配置 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 了

繼續閱讀