User/user group summary in Linux

Source: Internet
Author: User

1: What is a user? What is a user group?

User: Is the identity of the system users

User group: A collection of users with the same characteristics, sharing a certain power

2: Types of users and user groups?

User:

A. Administrator root: A user with all rights to the system, with a UID of 0.

B. Ordinary users: That is, the general user, the use of the system has limited access to the UID of 1000 after.

C. System users: To ensure that the system operation of users, generally do not provide password login system, the UID is between 1~999. Set in/etc/login.defs

User groups:

A. Common user groups: can join multiple users

B. System group: Generally add some system users

C. Private groups (also known as basic groups): When a user is created, if the owning group is not specified for it, a private user group is defined for it, and the name is the same as the user name.

Note: A private group can become a normal user group, and when other users are added to the group, it becomes a normal group

3: Files related to users and user groups?

User:
/ETC/PASSWD # # #用户信息
User: Password: uid:gid: Description: Home directory: User-used Shell
/etc/shadow # # #用户认证信息
User: Password: Last password modified this time: Minimum validity: Maximum validity: Warning Period: Inactive period: Account expiration date

/etc/skel/.* # # #用户骨架文件

User groups:

/etc/group # # #组信息
Group name: Group password: Group ID: Additional Group member
/etc/gshadow # # #组认证信息
/home/username # # #用户家目录

4: View the user's ID

ID parameter
-U user # #用户uid
-G User # #用户初始组id
-G # #用户所有所在组id
-N # #显示名称而不是id数字
-A # #显示所有信息
5: Creation and deletion of users and groups:
Useradd Zpy #建立用户, a private group is typically created at the same time as the user is established
Userdel-r zpy #-r Deleting a user's profile
Groupadd zpy #建立组
Groupdel zpy #因为组没有文件, so do not add-r
Creation and deletion of users and groups:
Useradd zpy
Userdel-r zpy #-r Delete a user's profile note: When you want to delete the name of the username and a group, if the group and this file, no relationship, then will not delete this group
Groupadd zpy
Groupdel zpy #因为组没有文件, so do not add-r
Useradd-p Mima User #指定用户密码
-U 1111 User #指定uid为1111
-G 1111 User #指定gid if this group exists
-C "Interpreting content" #指定解释内容
-d/home/file User #指定家目录

Note: Beginners must pay attention, the above for the establishment of the user when the way to specify some information, if you want to change, do not delete this user, re-establish by the way to specify, or use the following usermod instructions to make changes, after establishing the user, you can no longer establish

6: Changes to user information

Usermod parameter User
-L # #更改用户名称
-U # #更改uid
-G # #更改gid
-G # #更改附加组
-ag # #添加附加组
-C # #更改说明
-D # #更改家目录指定
-MD # #更改家目录指定及家目录名称
-S # #更改shell
-L # #冻结帐号
-U # #解锁
-s/sbin/nologin User #指定交互式
What is the difference between 7:passwd-l user and usermod-l user?

Passwd-l User
Passwd-u User
Lock appears two!!
Usermod-l User
Usermod-u User
Lock appears one!
A: The former level is higher, the lock will appear two exclamation mark!! The latter only one!!
If you unlock with usermod-u user!! Need to enter two times command
8: Analysis of/etc/skel/catalogue?

Every time you create a new user (via the useradd command), the files in the/etc/skel directory will be copied to the new user's home directory intact.


Ls-a/etc/skel/
.  .. . bash_logout. Bash_profile. BASHRC game. Mozilla
The best choice is to put these settings in the global/etc/profile, the files in the Skel directory are copied in the past, if you modify or add new files, only the new users can benefit.


9. File/directory owner all Group Management # # # # #
Chown User File/directory (-R) (directory recursion) #更改目录或文件所有人
CHGRP user File/directory (-R) (directory recursion) #更改目录文件所有组
Chown user. User files/directories (-R) #同时更改所有人所有组

This article is from the "12462896" blog, please be sure to keep this source http://12472896.blog.51cto.com/12462896/1949984

User/user group summary in Linux

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.