Skip to content

Instantly share code, notes, and snippets.

@CN-CODEGOD
Created July 2, 2026 05:13
Show Gist options
  • Select an option

  • Save CN-CODEGOD/61f0b31e5a263ac2b7152888ac1c5e17 to your computer and use it in GitHub Desktop.

Select an option

Save CN-CODEGOD/61f0b31e5a263ac2b7152888ac1c5e17 to your computer and use it in GitHub Desktop.
permit root login

要开启 Linux 服务器的 SSH root 远程登录,需修改 SSH 配置文件 sshd_config。操作步骤如下:1. 编辑配置文件通过命令行输入以下指令打开 SSH 配置文件:sudo nano /etc/ssh/sshd_config (也可使用 vim)2. 开启 root 登录找到 PermitRootLogin 选项,将其修改为:PermitRootLogin yes(注:如果该行前面有 # 注释符,需要删掉它)3. 重启 SSH 服务保存并退出编辑器后,重启 SSH 服务使配置生效:sudo systemctl restart sshd 或 sudo service sshd restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment