Add administrator account
1. Open the command line. The shortcut key is crtl + alt + T, or crtl + alt + F1 ~ F6
2. Run sudo useradd-g root XXX (xxx is your administrator account and cannot be root. Another example is ubuntu)
Alternatively, you can enable root directly.
Set the root password for sudo passwd.
Steps and methods
$ Is an ordinary administrator. # It is a system administrator. In Ubuntu, the root user does not have a password by default, so it cannot be used (it is said that it is for security ). To use root, you must set a password for the root user:
The code is as follows: |
Copy code |
Sudo passwd root
|
Then, enter root as the username and password at login.
It is best to use adduser for ubuntu users. Although adduser and useradd are the same in other linux operating systems, the user home directory with the same name is not created when I use useradd in ubuntu.
Example: adduser user1
In this way, the user's home directory will be automatically created to create a group with the same name as the user.
The code is as follows: |
Copy code |
Root @ ubuntu :~ # Sudo adduser db [Sudo] password for xx:
|
Enter the password of xx user. The following message is displayed:
Adding user "db "...
Adding new group "db" (1006 )...
Adding new user "db" (1006) to group "db "...
Create a home directory "/home/db "...
Copying files from "/etc/skel...
Enter a new UNIX password:
Enter a new UNIX password:
Enter the initial password of the database twice. The following information is displayed:
The code is as follows: |
Copy code |
Passwd: password updated successfully Changing the user information for db Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Full Name []: |
And press enter
Is this information correct? [Y/n] y
At this point, the user is added successfully. To grant the root permission to this user, run the following command:
The code is as follows: |
Copy code |
Root @ ubuntu :~ # Sudo vim/etc/sudoers
|
Modify the file as follows:
The code is as follows: |
Copy code |
# User privilege specification Root ALL = (ALL) ALL Db ALL = (ALL) ALL
|
Save and exit. The database user has the root permission.