File owners, other groups in the group-changing the user group
Groups and groups in the OA system are similar, the user represents the individual, the group is a bit like the meaning of the role. But the permission is not the individual from the group to obtain, the group is only a mechanism, the partial file control and sharing, management Authority mechanism, a bit similar to a container.
How to add a group to Linux
Groupadd Policeman
When adding a user, specify which group to add a user to
USERADD-G Group name User name
Root permissions change the group where a user is located:
USERMOD-G Group name User name
Change the initial directory of user login
usermod-d Directory name User name
View information for all groups in Linux
Vi/etc/group
Cat command, read-only view files
View information for all users in Linux
vi/etc/passwd
Example: Panpan:x:503:502::/home/panpan:/bin/bash
Panpan: User Name
X: Represents the user password, the encryption is not displayed, in X represents
503: User ID
504: ID of the group where the user is located
Space Place: User comment
/home/panpan: User's home directory
/bin/bash: User's Shell home directory
Shell
is responsible for the command and the Linux kernel to control the exchange of a controller, receive user commands, processing translation to the Linux kernel processing, the Linux kernel processing results to Shell,shell resolved after the return to the user.
We create the file Mytest.java under along and use Ls-l to view the file details
-rw-r--r--1 along policeman 4 14:42 Mytest.java
Split resolution:
The first-represents a file, if it is D, represents the directory directory
The rw-table represents the permissions that the file owner has, R is read, W is write,-the representation of the placeholder (x's position, X represents execution)
r--represents the permissions that the same group of users have on the file, which is read-only
r--indicates that other group users have specific permissions on the file, read-only
Spaces indicate separation
1 Number of files, the words of the file is always 1, folder words represent the number of files within the folder
Along represents the file owner
Policeman represents the grouping of files in
4 14:42 indicates creation time
Mytest.java is the full name of the file
chmod command to modify permissions for a file or folder
Add parameter-R or--recursive recursion to process all files and subdirectories under the specified directory
Otherwise, simply modifying the permissions of the folder will not affect the file inside.
For the section on the permission designator, list below:
R: Read permission, the number code is "4".
W: Write permission, the number code is "2".
X: Execute or toggle permissions, the number code is "1".
-: No permission, number code is "0".
S: Special?b> function Description: Change the permissions of a file or directory.
Typically the creator of the file, who created the file, is naturally referred to as the owner of the file
You can see the owner of the file with the Ls-l command
Modify the owner of the file with the Chown user name file name
Root can only
Commands to change permissions:
chmod changing the permissions of a file or directory
chmod 755 ABC: Give ABC permission rwxr-xr-x
chmod U=RWX,G=RW,O=RX ABC: Same as u= user rights g= permissions o= different groups other user rights
Other user rights in the same group:
chmod u-x,g+w ABC: for ABC to remove user-executed permissions, increase group Write permissions
chmod a+r abc:abc Read permissions to all users
Change the command of the owner (Chown) and user group (CHGRP)
Chown xiaoming ABC: Change the owner of ABC to Xiaoming
CHGRP Root ABC: Change the group that the ABC belongs to IS root
Chown root./ABC: Change the owner of the ABC directory to root
Chown-r root./ABC: Change the ABC directory and the owner of all files in the current directory as root
Linux file groups, permissions, etc.