2015.3.20 sixth session Linux user and group management

Source: Internet
Author: User

1,/etc/passwd

By: Split into 7 fields

(1) User name rules: uppercase and lowercase letters, numbers, minus signs (not appearing in the first place), dots, and underscores, other characters are illegal

(2) x put the password and put it on the/etc/shadow for security reasons.

(3) UID root uid=0 1-499 system reserved Normal account UID starting from 500

(4) GID correspondence/etc/group

(5) Note that the field is not meaningful, usually record the user's name, phone, address, change with CHFN

(6) User home directory

(7) Shell


2,/etc/shadow

By: Split 9 fields

(1) User name

(2) password is encrypted with SHA-512, irreversible

(3) The date the password was last changed, for example, the last time the password was changed is January 1, 2012, then this value is 365* (2012-1970) +10+1=15341

(4) How many geniuses can change the password, 0 unlimited

(5) Number of days after the password expires, the default of 99999, indicating never need to modify

(6) Warning period before expiry of password

(7) Account expiration period, the number of days after the expiry of the lock account

(8) The life cycle of the account, (9) as a reserved, meaningless


3. Add/Remove Users and Groups

Groupadd-g specifying GID

Groupdel If there are users within the group, you cannot delete

Useradd-u-g-d Specify home directory-m do not build home directory-S custom shell

Userdel-r Delete User and delete user home directory

Usermod-u-s-d-l-u-g-g

CHFN Finger


4. Create and modify user passwords

passwd

MKPASSWD is the tool that generates the password and needs to install the expect package


5. User Identity Switch

Su-Used to initialize environment variables $path $HOME, etc.

sudo su to root requires input of root password is not secure

Visudo Edit/etc/sudoers config file, no command required to install Yum install-y sudo

Format: User host= (as user) commands

For example: aming all= (Root)/bin/ls let aming this ordinary user has root authority, for LS this command



This article is from the "Rhythm" blog, make sure to keep this source http://rhythm.blog.51cto.com/2800158/1627579

2015.3.20 sixth session Linux user and group management

Related Article

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.