Permission to use under linux

 Permissions under Linux are mainly divided into two categories: owner and group.

 Use chown to change the owner of a file

Change the group of a file using chgrp 

 Use chmod to change file permissions  chmod 777 filename;

The chgrp command is used to change the user group to which a file or directory belongs. This command is used to change the user group to which the specified file belongs. The group name can be the id of the user group or the group name of the user group. The filename can be a space-separated list of files whose genus is to be changed, or a collection of files described by wildcards. If the user is not the file owner or superuser (root) of the file, the group of the file cannot be changed.

In the UNIX family of systems, the control of file or directory permissions is managed by the owner and the group to which they belong. You can use the chgrp command to change the group that files and directories belong to. The setting method can be either group name or group ID.

grammar

chgrp(options)(arguments)

Options

-c or --changes: The effect is similar to the "-v" parameter, but only the changed part is reported;
-f or --quiet or --silent: do not display error messages;
-h or --no-dereference: only modify the file of the symbolic link, not any other related files;
-R or --recursive: Recursive processing, processing all files and subdirectories under the instruction directory together;
-v or --verbose: Display the instruction execution process;
--reference=<reference file or directory>: Set the group to which the specified file or directory belongs to be the same as the group to which the reference file or directory belongs;

parameter

  • group: specify the new job name;
  • Files: Specify a list of files to change the group to which they belong. Use spaces to separate multiple files or directories.

example

Change the /usr/menguser group of all files in its subdirectories to mengxin

chgrp -R mengxin /usr/meng


The chown command changes the owner and group of a file or directory. This command can authorize a user to become the owner of the specified file or change the group to which the file belongs. User can be user or user D, user group can be group name or group id . The filename can be a list of files separated by spaces, and wildcards can be included in the filename.

Only the file owner and superuser can use this command.

grammar

chown (options) (parameters)

Options

-c or --changes: The effect is similar to the "-v" parameter, but only the changed part is reported;
-f or --quite or --silent: do not display error messages;
-h or --no-dereference: only modify the symbolic link file, without changing any other related files;
-R or --recursive: Recursive processing, processing all files and subdirectories in the specified directory together;
-v or --version: Display the command execution process;
--dereference: The effect is the same as the "-h" parameter;
-- help : online help;
--reference=<reference file or directory>: Set the owner of the specified file or directory and the group to which it belongs to be the same as the owner of the reference file or directory and the group to which it belongs;
--version: Display version information.

parameter

User:Group: Specify the owner and workgroup to which they belong. When ":group" is omitted, only the file owner is changed;
files: Specifies a list of files whose owner and workgroup are to be changed. Supports multiple files and targets, supports shell wildcards.

example

Change the file master of the directory /usr/mengand all files and subdirectories below it to liu:

chown -R liu /usr/meng













Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325815172&siteId=291194637