Linux Starter Base--linux user base

Source: Internet
Author: User

This content is Linux user base, related content see Linux change username and Ubuntu change username and host name.

User. Group
When we use Linux, we need to log in as a user, and a process needs to be executed as a user. Users restrict which resources the consumer or process can or cannot use.
the essence of the user is to restrict the use of resources


Groups are used to facilitate administrative organization management of users.


Each user has a userid, and the operating system actually uses the user ID. Rather than username.
Each user belongs to a primary group and belongs to one or more subordinate groups
Each group has a groupid
Each process executes as a user and is subject to the resource restrictions 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 in order to be compatible with older systems. The user ID is limited to 60000 below.
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.
-Average user (above 500). may be more than 1000)
The files in the system have a owning user and the owning group.


Use the ID command to display information about the current user
Use the passwd command to change 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 parts, each part using a colon: separate.


The first part of the username
The second part of the password
The third part of the user's ID number userid
Fourth Part group ID
The fifth part user's descriptive narrative information
Sixth part user's home folder
The seventh part of the user login shell (normal user is/bin/bash. System User ID 500 below is/sbin/nologin or/bin/false)
Open/etc/shadow
Each row represents a user information.
The first part of the username
The second part password (only the current user has password, the system user does not have password, two!

Indicates that no password was created)
Password is divided into three sections. The first part of using $ separate
is 6. The encryption type that represents password
The second part is salt salts, adding salt, is inserting this part into our password. Add crack difficulty
The third part is encrypted password
View logged in User
Command WhoAmI show current user
command who shows which users logged on
Command W shows which users have logged in and what to do
Create a user The
command useradd is used to create a user
How to determine if it is created? One more user is discovered through CAT/ETC/PASSWD. UserID is the current user id+1
This command runs the operation:
1. Add User
2 to/etc/passwd. Assume that password is created with the passwd command. The encrypted password is saved in/etc/shadow
3. Create a new home folder for users/home/houlu
4. Copy the files in the/etc/skel to the user's home folder
5. Create a group that is the same as the user username, the new user by default belongs to the same name Group
Command Useradd support the following parameters
-d     home folder
-s     Login Shell
-u    userid
-g     Main group
-g     Satellite group
can also be changed by direct change/etc/ passwd implementation. It is not recommended to do so.


change user Information
The command usermod is used to modify the user , which supports the following parameters
-L New username
-U new UserID
-D User home folder 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 folders
Userdel-r User All Delete
Group
Almost all operating systems have the concept of a group. Through the group, we are able to categorize 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 subordinate groups at the same time
Create, change, delete groups
Command Groupadd to create a group
Groupadd Linuxcast
Command Groupmod used to change the group
Groupmod-n newname oldname Change Group name
Groupmod-g newgid oldgid Change Group ID
Command Groupdel to delete a group
Groupdel Linuxcast

Linux Starter Base--linux user base

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.