The first knowledge of Linux's own home

Source: Internet
Author: User
Tags stdin

User Management  

Linux system is a multi-user multi-tasking time-sharing system, any user who wants to use system resources must first request an account from the system administrator and then enter the system as this account.

On the one hand, the user's account can help the system administrator to track the users who use the system and control their access to system resources, and on the other hand can help users organize files and provide security protection for users.

Each user account has a unique user name and a separate password.

When a user types the correct user name and password at logon, they are able to enter the system and their home directory.

To achieve the management of user accounts, the main tasks to be completed are as follows:

    • Add, delete and modify user accounts.

    • Management of user passwords.

    • Management of user groups.



First, user/group Basic concepts

1. Hardware, software, file programs require users and groups

2. View Current User Information

You can use the ID command to view user information

3. View the owner of the file

ll command View file owner

4. View the running process:

PS aux |less view Beijing

5. User and group storage files:

/etc/passwd

User name: Password placeholder: uid:gid: Descriptor: Home: Shell

· /etc/shadow: Main store user and password

root:$6$by9yooo4qyrgeo7g$vnjegfloyjoe1orni8qk4p/ Sk3ldgegvzxkzxo0429wyu.0htynzeyo4rqagudomaeaeo2jjp6.ilut.jjsc70:17544:0:99999:7 :::

Login: Encrypted password: Last modified: Minimum time interval: Maximum time interval: Warning Time: Inactivity time: Expiry time: Flag

/etc/group//information about the storage group

User group name: User group password: GID: User list

II. User/Group Management

1. Users

Create user unspecified option

Useradd to create a user's command

create user-specified options

- u Specify UID

- D Specify home directory

- s Specify Shell

- G join to satellite group

Delete User

Userdel to delete a user's command

-R Delete user's home directory and mailbox at the same time

Modify User Password

passwd Modifying user passwords

Modify User

Usermod Setting up Users

-G Specify additional groups

-g Specifies the base group

-A append Group

-S Modify the shell used by the user to log in

-D Modify the directory in which users log on

2. User Group

Groupadd creating groups

category

Basic group:

Additional groups:

Iii. rights to be raised (understanding)

Switching users with Su

Command Su-root

Running commands as root with sudo

/etc/sudoers//documents of the right of reference

Iv. Overview of commands

Useradd Creating a user

Userdel Deleting a user

Usermod Setting up Users

Groupadd creating groups

Groupdel Delete Group

The chage command is used to modify the expiration date of the account and password

passwd Change Password

V. Expansion of knowledge

the chage command is used to modify the expiration date of the account and password.

[Email protected]~]# useradd maomao100

[[Email protected]~]# echo 123456 |passwd--stdin maomao100//free interactive setup password

[[Email protected]~]# chage-d 0 maomao100//force user to change password at next login

Add accounts and Passwords in bulk

#!/bin/bash

passwd=linux1801

For i in {1..100}

Do

Useradd username$i

echo "$PASSWD" | passwd--stdin username$i

Done


The first knowledge of Linux's own home

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.