解除Ubuntu禁止root远程登录

Posted linuxprobe-sarah

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解除Ubuntu禁止root远程登录相关的知识,希望对你有一定的参考价值。

编辑SSH服务配置文件

编辑SSH服务的配置文件sshd_config,修改SSH的端口和root用户权限。

使用到的命令:(按字母 i 进入编辑模式,按ESC退出编辑模式, :wq 保存退出)。

[email protected]:~# vim /etc/ssh/sshd_config
1. 开放远程端口
找到 # port 22所在的那一行,复制该行内容并修改。

将 #port 22 修改为 port 22(将前面的 # 去掉)。

该行内容为设置SSHD服务的端口号
2. 允许root远程登录
找到 #PermitRootLogin prohibit-password那一行,复制该行内容并修改。

将 #PermitRootLogin prohibit-password 修改为 PermitRootLogin yes
3. 重启ssh服务
service sshd restart 或者 /etc/init.d/ssh restart

以上是关于解除Ubuntu禁止root远程登录的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu下开启ssh并允许root用户登录

root用户ssh可以登录,FileZilla sftp不能登录链接CentOS解决办法

luci禁止root用户登录但ssh允许root登录,怎么设置

Centos7 禁用本地root用户和禁止root远程登录

CentOS如何禁用root本地或远程ssh登录

ssh远程登录,禁止root登录