> ## Content Index
> Fetch the complete content index at: https://www.albert-yu.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# 關閉使用root作為SSH登入帳號
- URL: https://www.albert-yu.com/blog/ssh-root-login-settings/
- Published: 2017-01-04T16:17:41.000Z
- Updated: 2026-10-30T03:43:32.000Z
- Author: Albert Yu
- Tags: Linux/Unix, OS, root, ssh, Ubuntu

如果要允許使用root與密碼登入

ubuntu 與 centos 都可以修改 /etc/ssh/sshd\_config 內的設定

\[code language="css"\]

# vim /etc/ssh/sshd\_config

---

## ．．．．．．  
PermitRootLogin yes  
．．．．．．

\[/code\]

PermitRootLogin yes是允許使用，修改為NO

再將ssh服務重啟就禁止使用root登入