Linux Nine Yin Canon Heart Palm fragment 3

Source: Internet
Author: User

Users, groups, and permissions

Categories of Linux Groups
The user must belong to one and only one primary group
The group name is the same as the user name and contains only one user, the private group
Additional groups for users (supplementary group)
A user can belong to 0 or more secondary groups

Chsh Changing the user shell type

Chsh-s/etc/nologin Wang: Change Wang's shell type to Nologin type

Modify User Password Properties

[[email protected] ~] #chage rootchanging The aging information forRootenter The new value,orPress ENTER forThedefaultMinimum Password Age [0]:5 Minimum Password expiration dateMaximum Password Age [99999]:56 Maximum Password expirationLast Password change (YYYY-MM-DD) [2018-Geneva-Geneva]: 2018-040-04 Change Password time Password expiration Warning [7]:9 Password expiration alert timePassword Inactive [-1]: Grace period account Expiration Date (YYYY-MM-DD) [-1]: Account Validity

Modify the properties of the new account default user password

Nano/etc/login.defs

Pass_max_days maximum      validity pass_min_days   3   minimum validity Pass_min_len     5 pass_warn_age    7

Profiles for users and groups

Primary configuration files for Linux users and groups:
/ETC/PASSWD: User and its attribute information (name, UID, primary group ID, etc.)
/etc/group: Group and its attribute information
/etc/shadow: User passwords and their associated properties
/etc/gshadow: group password and its related properties

Within the shadow file, there will be a user behind! Number, which indicates a lock.

Useradd-u + user name unlocks user

Useradd-l + user name lock user

PASSWD-E + username to let the user password immediately expire, after the new login prompted to enter the old password, and then enter the password

User and group management commands?

User Management commands
?

[[Email protected] ~] #useradd-N Mage[[email protected] ~] #id mageuid=504(mage) gid=( Users) groups=(users)

Modify the user name and password of the original account, directly modify the passwd and shadow the user name within the two files, the ID number does not change .

/etc/skel User Home directory template, other users want to restore can be directly copied and overwritten.

Useradd Useradd-n + username does not create a primary group with the same user name, pointing to the default group is user
Usermod
Userdel


Group Account Maintenance Commands
Groupadd
Groupmod
Groupdel

Temporarily switch main group newgrp

[[email protected] ~] #newgrp aaaa[[email protected] ~] #touch a.txt[[email protected] ~] #ll a.txt 1 0 Apr  3: a.txt


View content in the specified user passwd

Getent passwd + user name

[[email protected] ~] #getent passwd magemage:x: 504::/home/mage:/bin/bash

Linux Nine Yin Canon Heart Palm fragment 3

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.