1, Useradd-- Create user
Simple to create a normal user (of course, you have to do it under root login)
useradd username - p password
tail
When you create a new user, you alsounder etc directoryof thepasswd fileTo add information about this new user in thewhen we create a successful user, vim /etc/passwd can see the user you just created at the bottom , or you canUsetail-3 etc/passwd command to display only the last 3 lines of the file.
3, Userdel-- Delete the user
Userdel username
4, create a normal user to a senior administrator
First look at the meaning of the user fields in passwd, such as root:
Root:x:0:0:root:/root:/bin/bash
In the middle with ":" Split, the corresponding meaning is:
User name: Password: uid:gid: Description: Home directory: Login using Shell.
In the/etc/passwd file we can take a look at root uid and gid what is it? We can see r , then we can Strong style= "Background-color:inherit;" , then you have root privileges.
6. su--Switching users
If there are multiple users, the SU command is available under the command-line window to switch to each other:
su User name
Description: SU is an abbreviation for switch user, which indicates a switchover.
enter "Exit" from the new user state to return to the user status you just made.
7. Add and delete user groups:
Groupadd testgroup -- Adding a user group
Groupdel testgroup --Deletion of user groups
8, VIM,tail-- View the new user group created
the Add and delete information for the group will be the group file for the ETC directory embodied in it. Use vim /etc/group and tail-3 /etc/group to view
9, Rm-rf testuser -- Delete the directory where the user testuser
After the user is created, the user's home directory is generated at//and the user's home directory can be deleted using rm-rf testuser If you want to delete the user.
This article is from the "Chi Mas" blog, please be sure to keep this source http://gpool.blog.51cto.com/1137393/1602661
Linux Create delete users and user groups