Linux User and User group management

Source: Internet
Author: User
Tags stdin

1 User Profiles

1.1 User Information file /etc/passwd

View Help man 5 passwd

--Account:password:UID:GID:GECOS:directory:shell

-account User name Notice specification

-PASSWD password flag x indicates password specific password in shadow

-uid user ID 0: superuser, determined by UID, not determined by user name

1-499: System User (pseudo user), cannot log on, cannot be deleted, called by system service or command

500-65535: Normal User

-gid Group ID Initial group ID user created groups, each user can only have one initial group, not recommended changes, specifically which group to see/etc/group

Additional groups: One user can also join multiple other user groups

-gecos User Description

-directory User home Directory Super User:/root/Normal User:/hoshme/user name/

-shell Login After the shell is the Linux command interpreter standard Shell:/bin/bash and/sbin/nologin cannot log in

1.2 Shadow file /etc/shadow

-1 User Name

-2 Encryption Password SHA512 hash encryption algorithm "!!" or "*" means no password and cannot log in

-3 Password Last modified date of the Linux timestamp after the nth day of 1970-1-1

-42 time interval for password modification

-5 Password Expiration date

-6 number of warning days before password modification expires

-7 grace days after password expiration 0 or no: Expiration immediately expires-1: No Expiration

-8 account Expiration Time timestamp indication

Timestamp-Date: date-d "1970-01-01 16066 Days"

Date-time stamp: Echo $ (($ (Date--date= "2015/10/13" +%s)/86400+1))

-9 Reserved fields

1.3.1 Group information file /etc/group

-1 Group names

-2 sets of password flags specific passwords are not recommended for use in /etc/gshadow

-3 GID group ID and UID are similar

-4 groups of additional users and passwd to know the initial user

1.3.2 Group password file/etc/gshadow

-1 Group names

-2 sets of passwords

-3 Group Administrator user names

-Additional users in Group 4

2 user Management related files are automatically created when users are added

2.1 User's Home directory

$ normal User/home/user name/Permissions 700

# Super User/root/Permissions 550

2.2 User's mailbox

/var/spool/mail/User Name

2.3 User Templates Directory

/etc/skel/

3 User Management commands

  Useradd [Options] User name

-u UID: Specify UID manually

-D Home Directory: Manually specify the home directory

-C User Description: Manually specify the user's description

-G Group Name: Manually specify the initial group

-G Group Name: Specify the user's additional group comma separated

-S Shell: Manually Specify the user's login shell. Default/bin/bash

    

User Default value File/etc/default/useradd

/etc/login.defs

  

  passwd Options [User Name]

Only Superuser can add [username], the normal user directly passwd

-S query the status of user passwords only for Superuser

-L lock User is actually changing the password bit in shadow with double exclamation marks

-U Unlock User

--stdin using a string as the user's password

echo "123" | passwd--stdin Zoro can be added in bulk by user shell programming

Linux User and User group 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.