Linux Operations Phase II (IV) User management

Source: Internet
Author: User

Linux Operations Phase II (iv) User management

I. Related documents

"/etc/passwd user information file

Root:x:0:0:root:/root:bin/bash(The 1th to 7th fields, in turn)

1. User name

2. Password Tag

3,uid: Super User root uid is 0, ordinary users to upgrade to Administrator,uid changed to 0 (not recommended to establish multiple administrator accounts; 1-499 System User uid(pseudo-user), can not log into the system, used to run the system or service, where 1-99 is the system reserved account, automatically created,100-499 is reserved for users to create system account; 500-65535 The UID of the ordinary user ,the 2.6 after the kernel can support 232

4. GID: If you do not specify the initial group to which the user belongs, a group with the same user name will be established

5. User Description

6. User home Directory

7. Login Shell

"/etc/shadow Shadow file

Root: password bit : 15775:0:99999:7::: (The 1th to 9th fields, in turn)

1. User name

2, encryption Password: can be in the password to join the previous "! "or"*"let the password temporarily expire, so that the user can not log in; all pseudo-user passwords are"!! "or"*"means no password can not login, the newly created user does not set a password is also"!! "

3, Password last change time: With time stamp display, take 1970-01-01 as standard Time

Timestamp change Date:#date-D "1970-01-01 15775 days"

date to timestamp:#echo $ (($ (Date--date= "2015/04/28" +%s)/86400 + 1))

4, two times password modification interval (compared to 3)

5. Password expiration date (compared to 3)

6.number of warning days before password modification expires (compared to 5)

7.Grace days after password expiration (compared to 5)

8, password expiration time, with time stamp representation

9. Reservation

"/etc/group Group information file

Root:x:0:root

1. Group name

2, group password bit

3. GID

4.other users are supported in this group, and additional groups are users of this group

"/etc/gshadow Group password file

If a group administrator is set up for the user group and a group password is set for the user group, the group password is saved in this file, and the administrator can use this password to manage the user group .

"User's home directory

"User mailbox directory /var/spool/mail

"User templates directory /etc/skel

"Manually delete the user, the following files need to be processed

/etc/passwd;/etc/shadow; /etc/group;/etc/gshadow;/home/user;/var/spool/mail/user

" The default value of Useradd is related to/etc/default/useradd and /etc/login.defs

Ii. User Management commands

#useradd User name (Common)

#useradd-u|-g|-g|-c|-d|-s User name

#userdel-R User name (delete user, with home directory deleted)

#passwd-l|-u User name (#passwd Enter to modify the current user password,#passwd user name, root only ,-L ( Lock),-u (unlock))

#usermod-u|-g|-c|-d|-s|-l|-u User name (Modify existing user information)

#usermod-L new name Old name (user renamed)

#groupadd Group name

#groupdel Group name

#usermod-G Group name User name (the existing user joins the group, note the difference between the following several commands)

#gpasswd-a user name Group name

#gpasswd-D user name Group name

Third, user-related commands

#id User name (displays the user's UID Initial group, additional group)

#su- User name (switch user identity, and environment variables have been switched)

#newgrp group1 (change effective group commands, valid groups, default genus when creating new files)

Four, the user rights to give

#groupadd Testgroup

#gpasswd-a AA Testgroup

#chmod 770/test

#chgrp Testgroup/test

From Brother Lian Training

This article is from the "Linux Operational Difficulty Learning notes" blog, please be sure to keep this source http://jowin.blog.51cto.com/10090021/1641469

Linux Operations Phase II (IV) User management

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.