Learning Linux - User management of common commands

User Management commonly used commands

New User useradd
userdel Delete user
passwd change password
usermod modify user attributes
chage modify user attributes

Linux is divided into two kinds of root user and ordinary users

When a user is added, the bottom of what has been done

When the user is created, it's home directory is / home / username The following
post when the user is created, it will be added to the / etc / passwd this file, you can query the following command
# tail 10 / etc / passwd can find the newly created user
when the user is created, it will be added to the / etc / shadow this file, you can query the following command, which is associated with the user's password file
# tail 10 / etc / shadow

# Id + user name can query whether the user system, because the system is assigned to the user id (root user id 0)

Only the root user has permission to create a normal user, not the other

# Passwd + username password to the user

# Userdel + username to delete a user would typically add -r option, if without -r, the user's home directory will be retained

# Usermod -d / home / dir + user name of the command to modify the user's home directory, it will make when the user logs on, the first visit of the new home directory, related profiles are placed in a new home directory

# Usermod -g group1 user1 modify user groups, the user1 group of users to modify group1

# Chage [options] user name + to change the user password expiration information

Group Management Command

groupadd New User Group
groupdel delete a user group

Groupadd group1 #
# the usermod -g group1 user1 create user groups and add users to the new user group

User Switching

su switch user

  • su - username using switch user login shell

sudo command allows the administrator to perform as a different user, without having to enter a password. Use this right at risk

  • sudo visudo edits that require the user's (group)

User and group profiles

/ etc / passwd
If you create a new user in / etc / passwd file, the user can create a new row of data. According to its form to fill in a new line, you can also create a new user
w: x: 1002: 1002 :: / home / w1: bin / bash meaning of the fields
Username: Password verify whether: a user ID, a unique identification system (change it to 0, will become root): ID group: Note: the user's home directory: user login command interpreter
during the last bash was changed to / sbin / nologin, users can not log terminal

/ etc / shadow
etc in the shadow file only the root user can view, save a local user password

/ etc / group
profiles user group format:
Group: X: 0: Field Meaning each
user group name: Verify whether the password: User Group ID: provided other groups

Guess you like

Origin www.cnblogs.com/chenri/p/12590371.html