Linux Learning Note 2 users

Source: Internet
Author: User

User

Definition: The user is the identity of the system consumer
The user is stored in the system as a number of channeling characters + several system configuration files
User information involves the system configuration file:
/ETC/PASSWD User Information

User: Password: uid:gid: Description: Home directory: User-used Shell
/etc/shadow User authentication Information
User: Password: Last password modified this time: Minimum validity: Maximum validity: Warning Period: Inactive period: Account expiration date
/etc/group Group Information
Group name: Group password: Group ID: Additional Group member
/etc/gshadow Group Certification Information
/home/username User Home Directory
/etc/skel/.* User Skeleton File


User Action Commands

ID Current View user information
Id-u User UID
-G user GID
-A user all information
-G The ID of the user where all
-un User Name
-GN User Initial Group name
-GN the name of all groups where the user resides
Su-username switching the environment used by user users
echo $PATH View the user environment for the current user
echo $USER display information for the current user

User management (Super User)

Useradd username New User
-U specify UID for user
-G Specify user initial group, this group must exist
-g Specifies the additional group, the same group must exist
-C User Description
-D Specify user home directory
-s Specifies the type of Shell,shell used by the user see/etc/shells

Userdel-r Deleting a user
Groupadd-g New Group,-G indicates the ID of the specified group
Groupdel Deleting a group
passwd Username change user Password

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/88/9C/wKiom1f8x1GA7fyHAADgYU73b20191.png-wh_500x0-wm_3 -wmp_4-s_701704886.png "title=" 8.png "alt=" Wkiom1f8x1ga7fyhaadgyu73b20191.png-wh_50 "/>

To view the commands used by the user establishment or management process
Watch-n 1 ' tail-3/etc/passwd;echo==;tail-3/etc/group '

Usermod-u changing user uid
-G change User Initial Group
-G change user Attach Group
-ag Adding user-attached groups
-d change user plus directory information
-MD change user home directory information and home directory name
-S change the user's shell
-C change User's description
-L Freeze User
-U Unlock User


User Empowerment (sudo)

Configuration file for permission devolution action
/etc/sudoers
This file is edited with the Visudo command.
Document content:
Authorized target User Host name = (new user authorized by user) authorize user to execute command

Note: The default is to edit at line 100th, if add nopasswd: You can not enter the password

Example: Enabling student users to create users

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/88/9C/wKiom1f8x2fjsAXZAAB_6C0uQw0303.png-wh_500x0-wm_3 -wmp_4-s_3714708436.png "style=" Float:none; "title=" 9.png "alt=" Wkiom1f8x2fjsaxzaab_6c0uqw0303.png-wh_50 "/>

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/88/99/wKioL1f8x2eQouKvAACudQ9H8RU907.png-wh_500x0-wm_3 -wmp_4-s_1010009360.png "style=" Float:none; "title=" 10.png "alt=" Wkiol1f8x2eqoukvaacudq9h8ru907.png-wh_50 "/>


Changes to user password age

Chage-d 0 Secret usage How long, how to set to 0 means the user must change the password before logging on to the system
-M minimum validity period
-M maximum validity
-W Warning Period
-I non-active period
-e Expiration Time format YYYY-MM-DD


Linux Learning Note 2 users

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.