Linux User group permissions

Source: Internet
Author: User
Tags md5 encryption

user and passwd files
features of the/etc/passwd file
/etc/passwd file specific meanings for each field
Shadow File
features of the/etc/shadow file
/etc/shadow file specific meanings for each field
groups and group files
features of the/etc/group file
features of the/etc/group file
How to add a new user account to a Linux system
features of the Useradd command
common options for the Useradd command
examples of the use of USERADD commands
To modify a user account using the usermod command
features of the Usermod command
usermod commands to modify user account information in common options
examples of the use of USERMOD commands
lock users and unlock users with the Usermod command
usermod–l Command
usermod–u Command
Use the Userdel command to delete a user account
features of the Userdel command
common options for Userdel
examples of the use of Userdel
Management of Groups
features of the Groupadd command
common options for the Groupadd command
examples of the use of GROUPADD commands
features of the Groupmod command
common options for the Groupmod command
examples of the use of GROUPMOD commands
features of the Groupdel command
examples of the use of Groupdel commands

"Content of this section"

See: http://cn.linux.vbird.org/linux_basic/0410accountmanager.php
1. User and passwd files
1) Master the function of the/etc/passwd file: Store all user related information, this file is also called the user information database.
2) The specific meaning of each field in the/etc/passwd file:
A) The 1th field (column) records the name of the user (the root user when the user was created).
b) the 2nd field (column) if it is X, indicates that the user must use a password when logging on to the Linux system, and if it is empty, the user does not need to provide a password when logging in.
c) the 3rd field (column) records the UID of this user.
d) The 4th field (column) records the GID of the group to which the user belongs.
e) the 5th field (column) records the comment information about the user (such as full name or mailing address).
f) the 6th field (column) records the path of the user's home directory.
g) The 7th field (column) records the first process to be executed after the user logs on.
2.shadow File
1)/etc/shadow file function: Store all user's password, each user occupies a row of records, the file is actually the database that holds the user's password.
2) The specific meaning of each field in the/etc/shadow file:
A) The 1th field (column) is a user name.
b) the 2nd field (column) is the password, which is a password that has been encrypted by the MD5 encryption algorithm.
3. Groups and group files
1) The function of the/etc/group file: Storing information about all the groups in the Linux system, which is actually a database that holds the group information.
2) The specific meaning of each field in the/etc/group file:
A) The 1th field is the name of the group.
b) The X in the 2nd field indicates that the group must use a password when logging on to the Linux system.
c) The 3rd field records the GID of this group.
d) The 4th Field records which group members are in the group.
4. How to add a new user account to a Linux system
1) Mastering the function of the Useradd command: Add a new user.
2) Learn about the common options for the Useradd command:
A) –u: Specify UID for user
b) –g: Specify the group to which the user belongs
c) –d: Specify the user's home directory
d) –c: Specify user's Notes information
e) –s: Specify the shell used by the user
3) Examples of flexible application of USERADD commands:
A) For example: Add a fox (FOX) User command to the system: Useradd Fox
b) For example: Add a user User01 to the system, a group of police and a command with a UID of 600:
Useradd–u 600–g Police User01
5. Modify user accounts using the usermod command
1) Master the function of the USERMOD command: Modify the user's account information.
2) Learn about the common options for the USERMOD command:
A) –u: Modify the UID of the user
b) –g: Modify the user's GID
c) –G: Add a user to the specified group
d) –d: Modify the user's home directory
e) –c: Modify User's Notes information
f) –s: Modify the shell used by the user
3) Examples of flexible application of USERMOD commands:
A) Modify the BABYDOG4 user's home directory to/home/babies command:
Usermod–d/home/babies Babydog4
b) Add the BABYDOG4 user to the Babydog6 command in this group:
Usermod–g Babydog6 Babydog4
c) Change the GID of the BABYDOG4 user to the order of the Dog Group:
Usermod–g Dog BABYDOG4
6. Lock the user and unlock the user using the Usermod command
1) Understand the function of Usermod–l: Lock the user's account
2) For an example of how to use the Usermod–l order:
For example: The command to lock the Babydog6 user's account: Usermod–l Babydog6
3) Understand the function of Usermod–u: Unlock the user's account
4) For an example of how to use the Usermod–u order:
Example: the command to unlock the Babydog6 user's account: Usermod–u Babydog6
7. Use the Userdel command to delete a user account
1) Master the function of the Userdel command: delete the user.
2) Learn about the common options for the Userdel command:
A) –r: Delete the user's home directory and its mailbox while deleting the user.
3) Flexible Application Userdel command to delete the user's example:
A) For example: Delete the command that BABYDOG5 user does not delete their home directory:
Userdel Babydog5
b) For example: Delete the Babydog5 user and delete the command for their home directory:
Userdel–r Babydog5
8. Management of the group
1) Master the function of the Groupadd command: Create a new group account.
2) Learn about common options for Groupadd commands:
c) –g: Specify GID for group
3) example of flexible application of GROUPADD commands:
For example: A new command for a group named Boydogs is added to the system:
Span style= "font-size:18px" >groupadd boydogs
4) Mastering the functions of the GROUPMOD command: Modify the information for a group account.
5) Learn about common options for GROUPMOD commands:
a) –g: Modify group GID
b) –n: Modify the name of the group
6) Examples of flexible application of GROUPMOD commands:
a" Example: Modify the police group's GID to 521 command:
groupmod–g 521 police
b) For example: The command to rename a group boydogs to daddogs:
groupmod–n daddogs boydogs
Span style= "font-size:18px" >7) mastering the function of the Groupdel command: Delete a group account.
8) Examples of flexible application of Groupdel commands:

How to view file permissions
ls Command detailed
root user and file security control
What is root user
User Category
File Operation Permissions
character representation of file operation permissions
Chown
chgrp
use symbolic notation to set permissions on a file or directory
features of the chmod command
the-r option of the chmod command
What is notation notation
3 parts of a permission state
example of symbolic notation
set permissions on a file or directory using numeric notation
What is digital notation
the number represents the resource permission state
examples of digital representations

1. How to view file permissions
1) Master Use the Ls–l command to view the permissions set on the file.
2) Master the ls–l command display results in the first column is divided into 4 groups, wherein;
A) The 1th character is the 1th group, which is either a file (-) or a directory (d), or another resource.
b) The 2nd, 3, 4 characters are Group 2nd, which defines the limited rights of the owner (owner) of the file or directory, and uses U to represent all the permissions of the owner (owner) on the file.
c) The 5th, 6, 7 characters are Group 3rd, which defines the permissions that other (users) have in the group where the owner of the file or directory resides, using G for this group permission.
D) 8th, 9, 10 characters are Group 4th, which defines the permissions that are not owner or other users of the same group as owner on the file or directory. Use o to represent this group (other) permission.
3) Master the owner and the group of the third and fourth column in the display result of the Ls–l command.
2.root User and file security control
1) Master the definition of the root user: The root user, also known as the Superuser, has unrestricted access to any user's account and all files and directories.
2) Understand the classification of users in Linux systems:
The Linux system divides all users in the system into 3 categories:
A) class 1th: Owner
b) class 2nd: Same group of users (FIX: Owning group, because the process of creating a user will create a group with the same name as the user name)
C) Class 3rd: Other users not in the same group
3) The ability to master file operations includes reading (read), write, and execute (execute)
4) master the Linux operating system when displaying permissions, use the following 4 characters to indicate file operation permissions:
A) R: Represents the Read permission, which is the ability to read the file or the LS command to list the contents of the directory.
b) W: Represents the Write permission, which is the right to edit the file or create and delete files in a directory.
c) x: Represents execute permissions, that is, the ability to execute a program or switch to this directory with the CD command, and to use the LS command with the-l option to list the permissions for the details in this directory.
D)-: indicates no corresponding permission (corresponds to R, W, or X at the location).
3. Master of modifying files using Chown
Chown: Genus Group File
Chown: Genus Group File
Chown Master File
A) For example, the command that modifies the file file1 is root: chown root file1
4. Mastering the genus Group that uses Chgrp to modify files
CHGRP Group File
A) For example, the command to modify the genus of the file File1 for WG is: CHGRP WG file1
5. Use the notation method to set permissions on a file or directory
1) Master the function of the chmod command: Set or change permissions on the file or directory.
2) Master-r option: not only set (or change) the directory permissions, but also recursively set (or) Change permissions for all files or subdirectories in that directory.
3) Mastery is the definition of symbolic notation:
Symbolic notation is the use of several specific symbols to set the state of a permission.
4) The State of authority can be divided into 3 parts:
A) The 1th section, which indicates whose permission state to set or change. The specific expressions are as follows:
U: Represents the owner's permission.
G: Represents the permissions of the group.
O: Represents a permission that is neither owner nor other user (other) with owner in the same group.
A: Represents the permissions of the above 3 groups, that is, all users (all).
b) The 2nd part, is the operator (operator), also known as the operator, wherein the specific expression is as follows:
+: Indicates permission to join
-: Means remove permissions
=: Indicates set permissions
c) Part 3rd, indicating the authority (permission), in which the specific expression is as follows:
R: Indicates read (read) permission.
W: Indicates write permission.
X: Represents the Execut (execute) permission.
5) flexibly apply symbolic notation to set or change permissions on a file or directory:
A) For example: Add the command for the owner and the same group of users to execute permissions on the Dog_wolf file:
chmod ug+x Dog_wolf
b) For example: The command to add write permissions to other users on the Babydog directory:
chmod o+w Babydog
6. Use numeric notation to set permissions on a file or directory
1) master the definition of digital notation:
digital notation refers to the use of a set of three-digit numbers to represent the state of a permission on a file or directory. Where:
The 1th number represents the owner's permission (U).
The 2nd digit represents the permissions of the group (g).
2) number represents the Resource permission status:
0: Indicates that there are no corresponding permissions.
3) flexibly apply digital notation to set or change permissions on a file or directory:
a) For example: Use numeric notation to open the/home/dog/babydog directory for owner and all permissions for all files in it, but to open read and execute permissions to the same group of users, and to open Read permissions to other users only:
chmod-r 754/home/dog/babydog

Linux User group permissions

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.