"Linux user, password, group management"

Source: Internet
Author: User

First, user and password
    • User account

Super User: Uid=0 root
Normal User: Uid!=0
System User: 0<uid<500 in order to maintain certain functions of the system or to implement certain services
Unable to complete the authentication at logon time
Normal User: uid>=500

    • Useradd
-C: Add comment information  for the created user -- e: Specifies the absolute time that the password expires for the created user, such as 2015/ G: Specify additional groups for the created user (other group)      --r: Create user as System  user -S: Specify default login shell for user created, default to/bin/-u: Specify UID for user created, The default starting from 500, the largest to 60000, by the system to choose to get     as small as possible from the large selection, if the user specifies, you can specify the UID range is2^1 

    • Usermod adjusting or modifying user information
option is the same as Useradd -L: Modify user Name

    • Userdel
-R: Delete home directory when user is deleted

    • ID print real and effective user and group IDs
-g: Show only valid group ID-g: Show all group IDs-u: Show only valid UID-N: Display with name instead of ID number
    • Finger User Information Browsing Program
    • passwd
-S: View user's password status -D: Remove user's password, set user's password to blank password -l:locked, set user's password status to locked state -U:unlock, Unlock user with password lock status -N: Set minimum age for user passwords, default is 0 days -x: Set maximum age for user passwords, default is 99,999 days -w  : Sets the number of days before the maximum age for the user's password to warn, default 7 days -I: Set the user's password after reaching the maximum age, you can continue to use the number of days, the default Infinity default function does not open, that is, indefinitely --  Echo " 12345 " passwd --stdin Link

Second, group management
    • Groupadd
-G: Specifies the GID cat/etc/group to create the group

    • GPASSWD set a password for a group; Add or remove additional groups for a user
-A: Add the user to the group and set the group to an additional group -D: Disassociate the group from the user
Groups~]# gpasswd-a HX hxxadding user HX to group hXX

    • NEWGRP logging into a new group
    • Groupmod
-G: Modify GID-N: Modify Group name

    • Groupdel

Note: If a group is a user's primary group (Basic group), then this group cannot be deleted

    • Groups to see which groups the user is in

    • Su

-: Use the login shell to complete the user switch, if not with any option, the default is to use the non-logon shell to complete the user switch

    • Whoami:print effective UserID

Third, the file that stores the information database class
    • /ETC/PASSWD Storing user account information
User account information. Format: Account:password (password Placeholder): UID:GID:GECOS (note):d irectory (home directory): shellroot:x: 0:0: Root:/root:/bin/bash

    • /etc/shadow information for storing user account passwords
Secure user account information. Format: root:$ 6$L 0v32/ikpv1sugwy$ IhmYeltaOEejZoJyBl47qoHbFilpfVlTMCC1ZX35wfmkXD8k3cwBwOX3.XiFuxhh7rI6OwOQOja28u8.XaM.j0:16565:0 :99999:7:: User login: Encrypted password: Last Password modified: password minimum validity: password maximum validity : password Duration: Password grace period: Password expiration: keep the field

    • /etc/group
Group account information. Format: group_name: passwd : Gid:user_list Write-only additional group haldaemon:x: : Haldaemon

    • /etc/gshadow
Secure group account information. Format: postfix:! :: Group name: encrypted Password: Administrator: List of users (add-on group only)

    • Default Template file/etc/default/useradd
  for file group = $ can be created directly user group home =/home Specify user home directory inactive =- 1 The grace period feature is not enabled expire= Expiration time is not enabled Shell=/bin/Bash default login Shellskel=/etc/Skel Default User script template location Create_mail_spool=yes whether to create a mailbox/var/spool/mail

    • /etc/skel/Templates for user scripts
Directory containing default files. .. . Bash_logout (Logoff script). Bash_profile (Login script). BASHRC

    • /etc/login.defs User Default login for configuration, default password time, minimum length, default Uid,gid

Shadow Password Suite configuration.


"Linux user, password, 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.