600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 腾讯云服务器Ubuntu系统如何使用 root 用户远程登录

腾讯云服务器Ubuntu系统如何使用 root 用户远程登录

时间:2022-02-21 23:45:46

相关推荐

腾讯云服务器Ubuntu系统如何使用 root 用户远程登录

问题描述:

腾讯云服务器Ubuntu 系统的默认用户名是 ubuntu,并且在安装过程中默认不设置 root 帐户和密码。如果想直接以root用户进行远程登录,可在设置中开启允许 root 用户登录。具体操作步骤如下:

解决方案:

1. 使用 ubuntu 帐户登录轻量应用服务器。

2. 设置root用户的登录密码

sudo passwd root

3. 输入 root 的密码,按 Enter。

4. 重复输入 root 的密码,按 Enter。

如果提示以下消息,即表示 root 密码设置成功。

passwd: password updated successfully

5. 执行以下命令,打开 sshd_config 配置文件。

sudo vi /etc/ssh/sshd_config

6. 找到 #Authentication,按 i 切换至编辑模式,将 PermitRootLogin 参数修改为 yes。

注意 : 如果 PermitRootLogin 参数被注释,请去掉首行的注释符号(#)。如下图所示:

#Authentication :#LoginGraceTime 2mpermitRootLogin yes#strictModes yes#MaxAuthTries 6#Maxsessions 10#PubkeyAuthentication yes

7. 找到 # Authentication,将 PasswordAuthentication 参数修改为 yes。

可能 # Authentication中没有 PasswordAuthentication,如果你和我一样的话那就在末尾添加上这个键值

#Example of overriding settings on a per-user basis#Match User anoncvs#x11Forwarding no#AllowTcpForwarding no#PermitTTY no#ForceCommand cvs serverPasswordAuthentication yes

8.按 Esc,输入 :wq,保存文件并返回。

9. 执行以下命令,重启 ssh 服务。

sudo service ssh restart

至此配置结束了,然后就可以用root远程登录 Ubuntu 轻量应用服务器了

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。