美文网首页
Ubuntu 系统如何使用 root 用户登录

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

作者: 夜空最亮的9星 | 来源:发表于2022-06-25 14:16 被阅读0次

    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

    相关文章

      网友评论

          本文标题:Ubuntu 系统如何使用 root 用户登录

          本文链接:https://www.haomeiwen.com/subject/zouivrtx.html