码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu 20.04 Server Enable root User Account

时间:2020-07-11 22:45:22      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:dmi   mini   add   res   strong   date   input   enable   call   

初始设置:启用root用户帐户

The root Account in Ubuntu is disabled by default because his password is not set. To use root priviledges, basically it‘s better to use the sudo command with administrative accounts. But if you‘d like to use root Account itself by some reason, it‘s possible to use like follows.

默认情况下,Ubuntu中的root账户是禁用的,因为未设置其密码。要想使用root特权,最好是将sudo命令与管理账户一起使用。但是,如果出于某种原因想要使用root帐户本身,则可以像下面这样使用

The user account added during installation is set an administrative account with sudo, so it‘s easy to get root account‘s shell like follows.

ubuntu@dlp:~$ sudo -s
[sudo] password for ubuntu:   # input self password
root@dlp:/home/ubuntu#        # just switched

Or it‘s possible to switch to root account with standard su command to set root account‘s password.

或者可以使用标准su命令切换到root帐户来设置root帐户的密码

ubuntu@dlp:~$ sudo passwd root
[sudo] password for ubuntu:   # input self password
New password:                 # set root password
Retype new password:          # confirm
passwd: password updated successfully

ubuntu@dlp:~$ su -
Password:                     # input root password
root@dlp:~#                   # just switched

The examples on this site shows by root user account. If you use sudo, add [sudo] on the head of commands.

It‘s better to restrict users who can [su] to root if you enable root account like follows. For using by sudo, it‘s possible to limit to prohibit shells in sudoers config, refer to details about sudo Settings.

For [su] command restriction, set like follows.

root@dlp:~# vi /etc/pam.d/su
# line 15: uncomment and add a group which is allow to run [su] command
auth       required   pam_wheel.so  group=adm

# add a user you allowed to run [su] to the group you set above
# 将您允许运行[su]的用户添加到上面设置的组中
root@dlp:~# usermod -G adm ubuntu

Ubuntu 20.04 Server Enable root User Account

标签:dmi   mini   add   res   strong   date   input   enable   call   

原文地址:https://www.cnblogs.com/PrimerPlus/p/13285803.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!