User and Group Management

Source: Internet
Author: User

1 how users exist with the system

/etc/passwd # Use information files

User name: User password: User uid : User gid: User description: User home directory: User-used Shell

/etc/shadow # user authentication information

User name: Password: Password Last modified date: Minimum validity: Password maximum validity: password warning period: Password inactive period: Password expiration Date:

/etc/group # User group Information

User group name: User Group password: User group ID: Additional user member

Initial group:

Additional groups: User-attached groups

/home/username # User home directory

/etc/skel/.* # Basic information configuration for users

Text Create new user is copy This file to user home directory

2. User Action Commands

ID View user Information

ID - u # # user uid

- G # # user gid

-A # # users All information

- G # # # users are all IDs

-un # # user name

-GN # # user Initial group name

-GN # # # users All group names

Su-username # # # Toggles the environment used by user users

Echo $PATH # # # View the user environment for the current user

Echo $USER # # # Displays information about the current user

3. Useradd # # # New user

- u # # # Specify uid for user

- G # # # Specify user initial group, this group must exist

- G # # # Specifies additional groups, and groups also exist

- C # # User Description

- D # # # Specify user plus directory

- S # # # Specify the shellThe user uses,shell type See /

Etc/shells Shell Type

4./etc/login.defs Default configuration when creating a user

Userdel - R # # # Delete users

Groupadd - G # # # New Group,-g indicates the ID of the specified group

Groupdel # # # Delete Group

passwd # # # change user password


5. view the commands used by the user to establish or manage the process

Watch-n 1 ' tail-3/etc/passwd;echo @@@@@@@@@@@@@@@@@@@@@@@@@@;tail-3/etc/group '

6. Usermod-u# # change user uid

- G # # change user initial group

- G # # change user-attached groups

-G "" # # Cancel all user groups

-ag # # Add user additional groups

- D # # change user home directory information

-MD # # change user home directory information and home directory name

- S # # change user's shell/sbin/nologin System user, not login

# # change user's description

- L # # freeze users

- u # # unlock users

Passwd-l Freezing user strength stronger

7. Devolution of user authority (sudo command Authority)

Configuration file for permission devolution action

/etc/sudoers

This file is edited with the visudo command ( directly with the command )

File contents

authorized target user host name =(new user identity granted to authorized users) authorizing users to execute commands

Test localhost=(root) Nopasswd:/usr/sbin/useradd

call with sudo

8. Password Age Change

User name: Password: Password Last modified date: Minimum validity: Password maximum validity: password warning period: Password inactive period: Password expiration Date:

chage - D 0 # # How long The secret is used, how to set it to 0 indicates that the user must change the password before logging on to the system

- M # # minimum validity

- M # # Maximum validity

- W # # warning period

- I. # # non-active period

- e # # expiry time format yyyy-mm-dd


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