Method one. If you already have a regular account and want to upgrade it to the root type of account, follow the procedure below.
vi/etc/passwd
The UID and GID of the user who will be modified are set to 0. Save.
Method Two. If you want to create a root-type account directly, for example, if I create an account called Yuri, execute the following command under the system root account:
Useradd-u 0-o-G root-g root-d/yuri Yuri
This allows you to create a root-type account. Then set the password:
passwd Yuri
You will be prompted to enter your password two times. Success.
Command parsing:
-U 0: Specifies that the UID is specified as 0 (0) as root, and the prompt after login is # instead of $.
-O: This parameter must be specified because the UID is duplicated (repeat with the root account uid).
-G Root: The group name of the initialization group, when the user belongs to more than one group, (as specified in the-G parameter), the group in which the login is located. By default, the system creates a new group with the same name as the user name, and is set to the group name when it is initialized. Regardless of which group-G is specified.
-G root: Specifies the list of groups to which the user name belongs, a user can belong to more than one group, the group name is separated by commas, and the group name must already exist.
-d/yuri: Specify the user's home directory
Yuri New user name Yuri
Reference: http://blog.chinaunix.net/uid-22166872-id-3551122.html
This article is Eliot original, reprint please indicate source: http://blog.csdn.net/xyw_blog/article/details/40664229
Linux Create root account