Skip to content

[ubuntu] 如何關閉 root 或特定使用者遠端 ssh 登入

Published: at 05:27 AM

租來的主機預設有開 root 遠端登入,這樣其實容易遭人惡意破解


  1. 編輯 /etc/ssh/sshd_config,更改

    PermitRootLogin no

  2. 若是要阻擋特定使用者使用 ssh 遠端登入

    DenyUsers root

  3. 重新啟動 ssh 服務 sudo service ssh restart

  4. 完成!!