Ubuntu and Windows, you can create or delete any new users, Windows is relatively simple, Ubuntu need to use commands, but the operation is not very cumbersome, so I try to write more detailed.
How to create a new Ubuntu user.
First open the terminal, enter: sudo adduser username, the system will prompt the following information:
Adding user "username" ...
Adding new Group "username" (1001) ...
Adding new user "username" (1001) to group "username" ...
Create home directory "/home/username" ...
Copying files from "/etc, Skel" ...
Enter a new UNIX password: (note here, instead of entering your current user's password, enter the password you want to create a new user)
Re-enter the new UNIX password: (You can lose again)
passwd: Password has been successfully updated
Changing the user information for username
Enter the new value, or press ENTER for the default
Full name []: Yangyang (Enter the name of the new user)
Number []:
Work Phone []:
Home Phone []:
Other []:
Is this information correct? [y/n] Y
At this point, the new user has been added successfully, at this time we can play ls/home view, if the display username yangming, the side on behalf of the user creation success. As shown in Figure 1.
Figure 1
To this, the user adds success. If you want this user to have root privileges, execute the command:
root@ubuntu:~# sudo vim/etc/sudoers
Modify the file as follows:
# User Privilege Specification
Root all= (All) all
DB all= (All) all
Save exit, the DB user has root privileges.
How to delete Ubuntu users.
Ubuntu Delete users are also operating under the terminal, it is important to note that if you want to delete the user is currently logged in, is deleted, you must log off the current user to switch to another user to delete. For example, just now I set up a new user for yangming user, for example I now use User yangming landed on the desktop, at this time if I want to delete yang this user, is deleted. The correct way to do this is, I write off Yang, and then use root to log on to the desktop, and then delete yangming.
Deleting Ubuntu user commands is easier to remember: sudo userdel username, for example I want to delete yangming, then enter: sudo userdel yangming, after deletion succeeds, the system does not have any prompts.
Useradd
1. Role
The Useradd command is used to establish the user account and create the user's starting directory, with the privilege being superuser.
2. Format
Useradd [-D home] [-s Shell] [-c comment] [-M [--template]] [-F inactive] [-e expire] [-P passwd] [-R] Name
3. Main parameters
-C: Add note text, note text is saved in passwd's remarks column.
-D: Specifies the start directory at which the user logged in.
-D: Change the preset value.
-e: Specifies the expiration date of the account and the default is permanent.
-F: Specify the number of days after the password expires to close the account.
-G: Specifies the group to which the user belongs.
-G: Specifies the additional group to which the user belongs.
-M: Automatically establish the user's login directory.
-M: Do not automatically create a user's login directory.
-N: Cancels the creation of a group named after the user name.
-R: Set up the system account.
-S: Specifies the shell to use when the user is logged in.
-U: Specifies the user ID number.
4. Description
Useradd can be used to create a user account, and it is the same as the AddUser command. After the account is built, use passwd to set the password for the account. The account created by using the Useradd command is actually saved in the/etc/passwd text file.
5. Application examples
Create a new user account and set the ID:
#useradd Caojh-u 544
It should be stated that the ID value should be set as much as 500 to avoid conflicts. Since Linux installation will create some special users, generally 0 to 499 of the value between the bin, mail, such as the system account.
EXAMPLE:
Execute the following command in the terminal:
# useradd-d/home/"username"-g "GID"-u "UID"-m-s/bin/bash "username"
# passwd "username"
"Username" to specify, "GID" must be an existing group ID, "UID" must not be used at present
All group information is available in the/etc/group file. The following command can create a new group:
# groupadd-g "GID" "Group name"