Create new users in ubuntu and add administrator permissions

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.