Linux命令:chmod

https://baijiahao.baidu.com/s?id=1616750933810368135&wfr=spider&for=pc

chmod --help

 Usage: chmod [OPTION]... MODE[,MODE]... FILE...
or: chmod [OPTION]... OCTAL-MODE FILE...
or: chmod [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE.
With --reference, change the mode of each FILE to that of RFILE. -c, --changes like verbose but report only when a change is made
-f, --silent, --quiet suppress most error messages
-v, --verbose output a diagnostic for every file processed
--no-preserve-root do not treat '/' specially (the default)
--preserve-root fail to operate recursively on '/'
--reference=RFILE use RFILE's mode instead of MODE values
-R, --recursive change files and directories recursively
--help display this help and exit
--version output version information and exit Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'. GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'chmod invocation'

man chmod

 CHMOD()                                                                            User Commands                                                                            CHMOD()

 NAME
chmod - change file mode bits SYNOPSIS
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE... DESCRIPTION
This manual page documents the GNU version of chmod. chmod changes the file mode bits of each given file according to mode, which can be either a symbolic representation of
changes to make, or an octal number representing the bit pattern for the new mode bits. The format of a symbolic mode is [ugoa...][[+-=][perms...]...], where perms is either zero or more letters from the set rwxXst, or a single letter from the set ugo. Multiple
symbolic modes can be given, separated by commas. A combination of the letters ugoa controls which users' access to the file will be changed: the user who owns it (u), other users in the file's group (g), other users not in
the file's group (o), or all users (a). If none of these are given, the effect is as if a were given, but bits that are set in the umask are not affected. The operator + causes the selected file mode bits to be added to the existing file mode bits of each file; - causes them to be removed; and = causes them to be added and
causes unmentioned bits to be removed except that a directory's unmentioned set user and group ID bits are not affected. The letters rwxXst select file mode bits for the affected users: read (r), write (w), execute (or search for directories) (x), execute/search only if the file is a directory
or already has execute permission for some user (X), set user or group ID on execution (s), restricted deletion flag or sticky bit (t). Instead of one or more of these let‐
ters, you can specify exactly one of the letters ugo: the permissions granted to the user who owns the file (u), the permissions granted to other users who are members of the
file's group (g), and the permissions granted to users that are in neither of the two preceding categories (o). A numeric mode is from one to four octal digits (-), derived by adding up the bits with values , , and . Omitted digits are assumed to be leading zeros. The first
digit selects the set user ID () and set group ID () and restricted deletion or sticky () attributes. The second digit selects permissions for the user who owns the file:
read (), write (), and execute (); the third selects permissions for other users in the file's group, with the same values; and the fourth for other users not in the
file's group, with the same values. chmod never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links
are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links
encountered during recursive directory traversals. SETUID AND SETGID BITS
chmod clears the set-group-ID bit of a regular file if the file's group ID does not match the user's effective group ID or one of the user's supplementary group IDs, unless
the user has appropriate privileges. Additional restrictions may cause the set-user-ID and set-group-ID bits of MODE or RFILE to be ignored. This behavior depends on the
policy and functionality of the underlying chmod system call. When in doubt, check the underlying system behavior. chmod preserves a directory's set-user-ID and set-group-ID bits unless you explicitly specify otherwise. You can set or clear the bits with symbolic modes like u+s and g-s,
and you can set (but not clear) the bits with a numeric mode. RESTRICTED DELETION FLAG OR STICKY BIT
The restricted deletion flag or sticky bit is a single bit, whose interpretation depends on the file type. For directories, it prevents unprivileged users from removing or
renaming a file in the directory unless they own the file or the directory; this is called the restricted deletion flag for the directory, and is commonly found on world-
writable directories like /tmp. For regular files on some older systems, the bit saves the program's text image on the swap device so it will load more quickly when run;
this is called the sticky bit. OPTIONS
Change the mode of each FILE to MODE. With --reference, change the mode of each FILE to that of RFILE. -c, --changes
like verbose but report only when a change is made -f, --silent, --quiet
suppress most error messages -v, --verbose
output a diagnostic for every file processed --no-preserve-root
do not treat '/' specially (the default) --preserve-root
fail to operate recursively on '/' --reference=RFILE
use RFILE's mode instead of MODE values -R, --recursive
change files and directories recursively --help display this help and exit --version
output version information and exit Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'. GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report chmod translation bugs to <http://translationproject.org/team/> AUTHOR
Written by David MacKenzie and Jim Meyering. COPYRIGHT
Copyright © Free Software Foundation, Inc. License GPLv3+: GNU GPL version or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
chmod() The full documentation for chmod is maintained as a Texinfo manual. If the info and chmod programs are properly installed at your site, the command info coreutils 'chmod invocation' should give you access to the complete manual. GNU coreutils 8.22 October CHMOD()

Linux命令:chown的更多相关文章

  1. Linux 命令 - chown: 更改文件的所有者和所属群组

    chown 命令用来更改文件或者目录的所有者和所属群组.使用这个命令需要超级用户的权限. 命令格式 chown [OPTION]... [OWNER][:[GROUP]] FILE... chown ...

  2. linux命令chown和chmod什么区别

    chown一般用来 更改属主.也就是文件所属用户.chmod功能要比chown要强大.可更改文件所有属性和权限.只有管理员账户才有权限用此命令. chown 是修改文件的所有者(owner),和所属组 ...

  3. 每天一个linux命令:chown

    1.命令简介         chown(Change owner) 用来改变某个文件或目录的所有者和所属的组,该命令可以向某个用户授权,使该用户变成指定文件的所有者或者改变文件所属的组.用户可以是用 ...

  4. linux命令: chown命令

    chown将指定文件的拥有者改为指定的用户或组,用户可以是用户名或者用户ID:组可以是组名或者组ID:文件是以空格分开的要改变权限的文件列表,支持通配符.系统管理员经常使用chown命令,在将文件拷贝 ...

  5. Linux 命令 -- chown

    chown命令改变某个文件或目录的所有者和所属的组,该命令可以向某个用户授权,使该用户变成指定文件的所有者或者改变文件所属的组.用户可以是用户或者是用户D,用户组可以是组名或组id.文件名可以使由空格 ...

  6. linux命令chown修改文件所有权

      Changing User Ownership To apply appropriate permissions, the first thing to consider is ownership ...

  7. linux 命令 chown, cp $

    文件拷贝命令: sudo cp  /xxx/XXX    $HOME/ 改权限: sudo  chwon $(id -u): $(id -g)  $HOME/admin.conf 加入环境变量: ex ...

  8. Linux命令:修改文件权限命令chmod、chgrp、chown详解

    Linux系统中的每个文件和目录都有访问许可权限,用它来确定谁可以通过何种方式对文件和目录进行访问和操作. 文件或目录的访问权 限分为只读,只写和可执行三种.以文件为例,只读权限表示只允许读其内容,而 ...

  9. linux命令之chown命令

    发布:JB01   来源:脚本学堂     [大 中 小] 本文介绍下,linux系统中用于文件与目录权限管理的命令 chown命令的用法,chown将指定文件的拥有者改为指定的用户或组.有需要的朋友 ...

随机推荐

  1. centos7部署openvpn-2.4.6

    一.环境说明 返回主机的IP地址 # ip a | grep "scope global" | awk -F'[ /]+' '{print $3}' | head -1 [root ...

  2. JDK、JRE与JVM的关系

  3. [UE4]UI动画

  4. android Information:Gradle tasks [:dl_version:generateDebugSources, :dl_version:generateDebugAndroidTestSources导致无法实现Preview功能

    Androidstudio 出现以下错误导致layout xml无法实现预览功能: Information:Gradle tasks [:dl_version:generateDebugSources ...

  5. 对偶上升法到增广拉格朗日乘子法到ADMM

    对偶上升法 增广拉格朗日乘子法 ADMM 交替方向乘子法(Alternating Direction Method of Multipliers,ADMM)是一种解决可分解凸优化问题的简单方法,尤其在 ...

  6. tp3.2分页

    tp3.2分页 使用tp3.2自带的分页类 <?php // +----------------------------------------------------------------- ...

  7. WebView加载失败或网络异常时,替换WebView的错误界面;

    WebView在加载失败时会显示一个失败原因的界面,各个手机显示的界面还都不一样,部分手机还会把Url显示出来:我们要做的就是统一加载失败的界面: 大概思路:在WebView这个控件上面再覆盖一个Vi ...

  8. SAP work process Memory allocate

    Memory allocation sequence to dialog work processes in SAP What is the memory allocation sequence to ...

  9. 读O目标KR关键结果的一些个人理解

    O目标KR关键结果 为了完成一个目标,需要完成几个或者多个关键的结果来验证. 书的开头写的是一些理论,有印象的东西还是从汉娜和杰克的公司来说,卖茶叶的公司.联系着茶农和可以产生消费的餐馆和供应商,在未 ...

  10. 销售人员的分析,也可以用类似RFM的思路吗?

    本文转自知乎 作者:接地气的陈老师 ————————————————————————————————————————————————————— 有同学问:“销售人员的分析,也可以用类似RFM的思路吗, ...