05-linux Foundation II

Source: Internet
Author: User
Tags chmod md5 encryption user definition

1. User and passwd files

1) Functions of the/etc/passwd file: stores information about all users, which is also known as 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) Function of useradd command: Add a new user.
2) 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 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. usermod command to modify user account

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 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) usermod–l function: Lock the user's account
2) Examples of the use of Usermod–l orders:
For example: The command to lock the Babydog6 user's account: Usermod–l Babydog6
3) usermod–u function: Unlock the user's account
4) Examples of the use of Usermod–u orders:
Example: the command to unlock the Babydog6 user's account: Usermod–u Babydog6

7. Use the Userdel command to delete a user account

1) Function of userdel command: delete user.
2) 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 the common options for the Groupadd command:
–g: Specify the GID for the group
3) Examples of flexible application of GROUPADD commands:
For example, a new command for a group named Boydogs is added to the system:
Groupadd Boydogs
4) Master the function of the GROUPMOD command: Modify the information of a group account.
5) Learn about the common options for the Groupmod command:
A) –g: Modify the group's GID
b) –n: Modify the name of the group
6) Examples of flexible application of GROUPMOD commands:
A) For example: Modify the police group's GID to 521 command:
Groupmod–g 521 Police
b) For example: The command to rename the group Boydogs to Daddogs:
Groupmod–n Daddogs Boydogs
7) Master the function of the Groupdel command: Delete a group account.
8) Examples of flexible application of GROUPDEL commands:
Example: Delete the daddogs Group command: Groupdel daddogs

9. 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.

10.root user and File security control

1) root user definition: Root user also known as Superuser, it can access any user's account and all files and directories without restriction.
2) User classification in Linux system:
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).

11. 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

12. 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

13. Use the notation method to set permissions on a file or directory

1) function of the chmod command: Set or change permissions on a file or directory.
2)-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 permission state 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

14. Use digital notation to set permissions on a file or directory

1) Master the definition of digital notation:
Numeric notation refers to the use of a set of three-digit numbers to represent the state of permissions on a file or directory. which
The 1th number represents the owner's permission (U).
The 2nd number represents the permissions of the group (g).
The 3rd number represents the Permissions (o) for other users (other).
2) The number represents the resource permission state:
4: Indicates a read permission.
2: Represents a Write permission.
1: Indicates that there is execute (EXECUTE) permission.
0: Indicates that there is no corresponding permission.
3) Flexible application of digital notation to set or change permissions on a file or directory:
A) For example: use digital notation to open the/home/dog/babydog directory and all of the permissions for all files in the owner, but to open read and execute permissions to the same group of users, and to open only read permissions to other users of the command:
Chmod-r 754/home/dog/babydog

05-linux Foundation II

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.