Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ User and user group management Linux Command     - Perl loop (Programming)

- Linux dmidecode command detail (Linux)

- JDK installation under CentOS (Linux)

- Windows SmartGit installation (Linux)

- Linux foreground to background process switch (Linux)

- MyCAT easy entry (Database)

- Close and limit unused ports computer server security protection (Linux)

- Using nmcli commands to manage network in RedHat / CentOS 7.x (Linux)

- SendMail version of Java implementation with attachments (Programming)

- Detailed use Zabbix monitoring Nginx (Server)

- Linux process stack and process function stack frame (Linux)

- MySQL to manage multiple instances of method (Database)

- Sqoop data export import command (Database)

- Learning UNIX good habits (Linux)

- C ++ CBitmap, HBitmap, Bitmap difference and contact (Programming)

- Linux pwd command learning experience (Linux)

- CentOS5 installation Nodejs (Linux)

- Linux System Getting Started Learning: complete installation on Debian or Ubuntu kernel source (Linux)

- Ubuntu 10.10 install Oracle 10g graphic tutorials (Database)

- Echo Command Examples (Linux)

 
         
  User and user group management Linux Command
     
  Add Date : 2018-11-21      
         
         
         
  1, Users and groups

groupadd: to add a new group
    The format is as follows:
        groupadd [-option] group name
    Common parameters:
        -g GID: Specifies created GID group (GID greater than 500 numbers)
    Example [1] to add a group called teama and specify a GID of 555, use the command:
            groupadd -g 555 teama
    Note (PS): If you do not add the -g parameter, by default the system will automatically assigned GID (user belongs to the group identification code) are arranged sequentially from 500

groupdel: used to delete an existing group
    The format is as follows:
        groupdel [-option] group name
    Note (PS): The user must be deleted before you delete a group within a group

useradd: to create a new user
    The format is as follows:
        useradd [-option] Username
    Common parameters:
        -u UID: Create UID specified group, if not specified, the system automatically assigns
        -g GID / groupname: Specifies the user's new group, you can use GID or group name. If you do not specify a cluster group, the system automatically creates a user and group of the same name, and the user to join the group
        -M: Do not build "home" directory, if you do not use this parameter, the default home directory to establish
        -s shell: Specifies the user logs enabled shell, if not specified, the general use / bin / bash
        -G: Specifies that the user belongs to the root group
    Example [1] Create a user named testa, specifying its UID 555, and specifies that the user added teama group, and specify the use of C-shell, use the command:
              useradd -u 555 -g teama -s / bin / bash testa
            The command is executed, we can see testa directory under / home directory, which is the user's system created by default "home" directory
    [Example 2] to create a user named usera, and belongs only to root groups, use the command:
              useradd -g root usera
    Example [3] to create a user named userb that belong to root groups, are also userb group, use the command:
              useradd -G root userb
           

userdel: to delete the existing user
    The format is as follows:
        userdel [-option] Username
  Common parameters:
        -r Parameter the user's home directory and mail files be deleted if you do not add this parameter, only delete the account, the purpose is to reduce the junk files, it is recommended to execute the command: -r
  Example [1] and remove usera userb users on cases created will be deleted along with their home directories and mail file, use the command:
              userdel -r usera userb

usermod: used to modify user information
    The format is as follows:
        usermod [-option] Username
  Common parameters:
        -u UID: Set the user's UID
        -g GID / groupname: set the user groups, you can use GID or group name.
        -s shell: Specifies the user logs enabled shell.

2, the user password command

passwd: used to set the user's password
    The format is as follows:
        passwd [username]
    Common parameters:
        -d: delete the current password
        -k: Password never expires
        -l: Lock User
    Note (PS): 1) If you do not follow behind passwd user name, then modify the current user's password
              2) Only the super administrator root password can be assigned to other users, ordinary users can modify their own passwords

3, you can switch command

su: for switching user identity
    The format is as follows:
        su [-] [username]
    Note (PS): 1) If you use the "-" sign indicates a complete switch to another user's environment, and vice versa using the current user environment.
              2) cut from the root user to ordinary users do not need to enter a password, otherwise you will need to enter a password before you can complete the switch.
              3) If you want to return to the original user, use the exit command, use the same user at the terminal exit.

4, the user query

id: used to display the user's UID, GID and owned by the group
    Command format is: id [username]

groups: group information is used to display the user belongs
    Command format is: groups [username]
     
         
         
         
  More:      
 
- Oracle ordinary users show parameter method (Database)
- RHEL6.4 one key installation Redmine (Linux)
- Replace font under Linux (Linux)
- Xshell upload files to achieve Windows host Linux (Linux)
- How to view the Linux graphics hardware information (Linux)
- Linux ACL permissions (Linux)
- Ubuntu 32 compile Android 4.0.4 Problems (Linux)
- Wireshark basic introduction and learning TCP three-way handshake (Linux)
- Java Virtual Machine Basics (Programming)
- Monitor log file (listener.log) (Database)
- Nodejs complete installation instructions for Express (Linux)
- Use the TC flow control test under Linux (Linux)
- Oracle 10g New Features - Archive Compression (Database)
- Android Application Development: Genymotion can not start solving (Linux)
- VirtualBox virtual machine can not start to solve under Ubuntu (Linux)
- The virtual memory (Linux)
- Use Vagrant build cross-platform development environment for Python (Server)
- Executable file format Explanation under Linux (Linux)
- How SSHfs mount a remote file system on Linux (Linux)
- 20 Advanced Java interview questions summary (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.