Skip to content
1
/ System/SSH
1/14/2026
1m
AI 摘要

本文介绍了如何通过修改 SSH 配置,允许 root 用户直接登录,简化登录流程。主要步骤包括:设置 root 密码、修改 PermitRootLogin 配置项为 yes、重启 ssh 服务,从而实现 root@password 登录。

SSH

SSH 相关

默认 root 登录

解决现有非 root 用户登录,再切换为 root 的繁琐

步骤一:

切换为 root 用户,设置密码:

$ sudo passwd root

步骤二:

设置允许 ssh 登录 root 用户:

$ sudo vim /etc/ssh/sshd_config

找到 #PermitRootLogin prohibit-password 这行(通常被注释了),将其改为 PermitRootLogin yes

步骤三:

重启 ssh 服务:

$ sudo service ssh restart

然后就可以用 root@password 登录 SSH 了

Released under the MIT License.