Article Directory
Add User / Group / delete
1. Concepts
1.1 User Classification
Linux is a multiuser, multitasking operating system, divided according to user roles
-
root user : the system the only landing system, any operating system files and commands, with the highest authority.
-
Virtual Users : These users also known as pseudo-user or fake users, and to distinguish real users, such users do not have the capabilities to access the system, but the system is running indispensable users, such as bin, daemon, adm , ftp, ssh, mail and so on. Such users are owned by the system itself, rather than the user thought to add, of course, we can also add virtual users.
-
Ordinary real users : these users can log in the system, but can only operate their own home directory contents. Limited rights, such users are system administrators to add their own. This section of the user used for the average user, the system using the account to complete the operation of their needs. In the / etc / passwd can be seen in the presence of various accounts.
1.2 User Group
User group : aggregate users having the same characteristics.
Correspondence between the users and groups: one to one, many-to-many.
2. Common Commands
- Create a user
useradd
tianliang // New user tianliang
passwd
tianliang // user password to tianliang
- Display user information
id user // view the user's uid, gid, groups attribute
- Creating user groups
tlgroup groupadd
// New tlgroup Working Group
-g useradd
tlgroup tianliang // New tianliang users and groups of users increased to tlgroup.
Which belongs to the group -g -s -d home directory used by shell
- Existing users to increase workgroup
-g the usermod
tlgroup tianliang // modify the user's gid, i.e. belonging group modified
-a the gpasswd
tianliang tlgroup // added to the user group in tlgroup
-G the usermod
tlgroup tianliang // added to the user group in tlgroup, tlgroup a non-primary group
- Delete user accounts
tianliang userdel
// permanently delete the user, you do not empty their / home / tianliang directory
- Completely delete a user : whether to remove the user's home directory and other relevant documents to distinguish
-r userdel
tianliang // delete all the data in the home directory of users and their tianliang
- Remove a user from a user group
-d gpasswd
tianliang tlgroup // delete from the group tlgroup out tianliang user
- Deleting User Groups
groupdel
tlgroup // delete the group, but the group is the primary group of time a user can not be deleted
- / Etc / passwd file parsing
This file stores user information is an operating system, the file is visible to all users, it contains seven information fields, by cat etc / passwd Check / as follows:
username
Password (encrypted)
UID : user identifier, CentOS operating system own use
UID=0是超级用户。
UID=1~499是伪用户(与系统和程序服务相关)
UID=500~60000为普通用户
GID : group identity, CentOS applicable
GID=0是超级组
GID=1~499与系统和程序服务相关的组,如sshd等
GID=500~60000为普通组,即自定义新增的组
Full name or local accounts
Starting directory - Home directory
Log in using the Shell, is a command for landing parsing tool