2

Debian 设置 root 用户 SSH 登录

 3 years ago
source link: https://devops.chat/11318.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

2020043012052331.png

Debian 设置 root 用户 SSH 登录

Debian 系统安装完毕后,默认的配置是禁止 root 使用 ssh 登录。只能使用普通用户 ssh 登录到 Debian 后使用 su 切换到 root 用户。反复每次都要这样操作时间久了就是不爽,可以直接使用 root 账户 ssh 登录吗?肯定是可以的,通过修改 ssh 配置文件允许使用 root 账户使用 ssh 登录。

先用普通用户登录到 Debian 然后 su 切换到 root 账户,编辑 /etc/ssh/sshd_config 配置文件;将配置文件中的 PermitRootLogin、PermitEmptyPasswords 这两项修改为 yes 并去掉前面的注释符,下图中是我已经修改好的,可以参照。修改完毕保存后需要重启 ssh 服务。

  1. su root # 切换到 root 账户;
  2. vim /etc/ssh/sshd_config # 编辑 SSH 的配置文件;
  3. PermitRootLogin yes # 去掉 PermitRootLogin 前面的注释符,修改为yes;
  4. PermitEmptyPasswords yes # 去掉 PermitEmptyPasswords 前面的注释符,修改为yes;
  5. systemctl restart ssh # 重启 SSH 服务;

Debian 设置 root 用户 SSH 登录-DevOps

Debian 设置 root 用户 SSH 登录-DevOps

点点赞赏,手留余香

给TA打赏
本站积分可以通过签到或者购买获得;1RMB=10积分
0

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK