Ubuntu 系统如何使用 root 用户登录

Ubuntu 系统的默认用户名是 ubuntu,并在安装过程中默认不设置 root 帐户和密码。您如有需要,可在设置中开启允许 root 用户登录。具体操作步骤如下:

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

设置root用户密码

执行以下命令,设置 root 密码。

sudo passwd root

输入 root 的密码,按 Enter。

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

返回如下信息,即表示 root 密码设置成功。

passwd: password updated successfully

配置 sshd_config 文件。

sudo vi /etc/ssh/sshd_config 

<!-- 找到PermitRootLogin 参数修改为 yes -->

 32 #LoginGraceTime 2m
 33 #PermitRootLogin prohibit-password
 34 PermitRootLogin yes
 
 <!--将 PasswordAuthentication 参数修改为 yes-->

 57 # To disable tunneled clear text passwords, change to no here!
 58 PasswordAuthentication yes
 59 #PermitEmptyPasswords no

说明 若 sshd_config 配置文件中无此配置项,则添加 PasswordAuthentication yes 项即可。

重启 ssh 服务。

sudo service ssh restart

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容