Linux Starter Base--linux user base

Source: Internet
Author: User

Linux User base
User, Group
When we use Linux, we need to log in as a user, and a process needs to run as a user, restricting users or processes from being able to use them, and not using any resources.
The essence of the user is to restrict.
Groups are used to facilitate administrative organization management of users.
Each user has a userid, and the operating system actually uses the user ID, not the user name
Each user belongs to one primary group and belongs to one or more subordinate groups
Each group has a groupid
Each process runs as a user and is limited by the resources that the user can access
Each user who can log on has a specified shell.
User
The user ID is 32 bits, starting from 0, but for compatibility with older systems, the user ID is limited to less than 60000.
The user is divided into the following three types:
-root User (User ID 0 is the root user)
-The System User (1-499) is created specifically for some processes or services and does not own the shell.
-Regular users (over 500)
The files in the system have a owning user and the owning group.
Use the ID command to display information for the current user
Use the passwd command to modify the current user password
Related documents
/ETC/PASSWD Saving User Information
/etc/shadow Save user Password (encrypted)
/etc/group Saving Group Information
Open/etc/passwd
Each row represents a user's information, each line is divided into seven sections, each with a colon: separated.
First part user name
The second part of the password
The third part of the user's ID number userid
Fourth Part group ID
Fifth Section user's description information
Sixth part user's home directory
The seventh part of the user login shell (normal user is/bin/bash, the system user ID of 500 or less is/sbin/nologin or/bin/false)
Open/etc/shadow
Each row represents a user information.
First part user name
The second part of the password (only the current user has a password, the system user does not have a password, two!!) Indicates no password was created)
Password is divided into three parts, using $ separate
The first part is 6, the encryption type that represents the password
The second part is salt salts, adding salt, is inserting this part into our password, increasing the crack difficulty
The third part is the encrypted password
View logged-in users
Command WhoAmI display the current user
Command who shows which users are logged on
Command W shows which users are logged in and what they are doing
Create a user
Command Useradd used to create a user
How to determine whether to create a good? CAT/ETC/PASSWD Discovery will be one more user, UserID is the current user id+1
This command will perform the operation:
1. Adding users to/etc/passwd
2. If you create a password using the passwd command, the encrypted password will be saved in/etc/shadow
3. Create a new home directory for users/home/houlu
4. Copy the files in the/etc/skel to the user's home directory
5. Create a group with the same name as the user, and the new user belongs to this group by default
Command Useradd supports the following parameters
-D Home Directory
-S landing shell
-U userid
-G Master Group
-G subordinate Group
You can also do this by directly modifying the/etc/passwd implementation, which is not recommended
Modify user Information
Command Usermod supports the following parameters
-L New User name
-U new UserID
-D User Home directory location
-G user-owned primary group
-G user-owned affiliate group
-L lock user so that it cannot log on
-U release Lock
Delete User
Command Userdel to delete a specified user
Userdel user deletes users, but does not delete home directories
Userdel-r User Delete all
Group
Almost all operating systems have the concept of a group, through which we can classify more aspects and manage users. In general, we use divisions, functions, or geographic areas to create usage groups.
Each group has a group ID
Group information saved in/etc/group
Each user has a primary group with a maximum of 31 satellite groups
Create, modify, delete groups
Command Groupadd to create a group
Groupadd Linuxcast
Command Groupmod to modify the group
Groupmod-n newname oldname Modify Group name
Groupmod-g Newgid oldgid Modify Group ID
Command Groupdel to delete a group
Groupdel Linuxcast

Linux Starter Base--linux user base

Related Article

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.