zoukankan      html  css  js  c++  java
  • Linux命令:chown

    Linux命令:chmod

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

    chmod --help

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

    man chmod

      1 CHMOD(1)                                                                            User Commands                                                                            CHMOD(1)
      2 
      3 
      4 
      5 NAME
      6        chmod - change file mode bits
      7 
      8 SYNOPSIS
      9        chmod [OPTION]... MODE[,MODE]... FILE...
     10        chmod [OPTION]... OCTAL-MODE FILE...
     11        chmod [OPTION]... --reference=RFILE FILE...
     12 
     13 DESCRIPTION
     14        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
     15        changes to make, or an octal number representing the bit pattern for the new mode bits.
     16 
     17        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
     18        symbolic modes can be given, separated by commas.
     19 
     20        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
     21        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.
     22 
     23        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
     24        causes unmentioned bits to be removed except that a directory's unmentioned set user and group ID bits are not affected.
     25 
     26        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
     27        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‐
     28        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
     29        file's group (g), and the permissions granted to users that are in neither of the two preceding categories (o).
     30 
     31        A numeric mode is from one to four octal digits (0-7), derived by adding up the bits with values 4, 2, and 1.  Omitted digits are assumed to  be  leading  zeros.   The  first
     32        digit selects the set user ID (4) and set group ID (2) and restricted deletion or sticky (1) attributes.  The second digit selects permissions for the user who owns the file:
     33        read (4), write (2), and execute (1); 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
     34        file's group, with the same values.
     35 
     36        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
     37        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
     38        encountered during recursive directory traversals.
     39 
     40 SETUID AND SETGID BITS
     41        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
     42        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
     43        policy and functionality of the underlying chmod system call.  When in doubt, check the underlying system behavior.
     44 
     45        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,
     46        and you can set (but not clear) the bits with a numeric mode.
     47 
     48 RESTRICTED DELETION FLAG OR STICKY BIT
     49        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
     50        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-
     51        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;
     52        this is called the sticky bit.
     53 
     54 OPTIONS
     55        Change the mode of each FILE to MODE.  With --reference, change the mode of each FILE to that of RFILE.
     56 
     57        -c, --changes
     58               like verbose but report only when a change is made
     59 
     60        -f, --silent, --quiet
     61               suppress most error messages
     62 
     63        -v, --verbose
     64               output a diagnostic for every file processed
     65 
     66        --no-preserve-root
     67               do not treat '/' specially (the default)
     68 
     69        --preserve-root
     70               fail to operate recursively on '/'
     71 
     72        --reference=RFILE
     73               use RFILE's mode instead of MODE values
     74 
     75        -R, --recursive
     76               change files and directories recursively
     77 
     78        --help display this help and exit
     79 
     80        --version
     81               output version information and exit
     82 
     83        Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.
     84 
     85        GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report chmod translation bugs to <http://translationproject.org/team/>
     86 
     87 AUTHOR
     88        Written by David MacKenzie and Jim Meyering.
     89 
     90 COPYRIGHT
     91        Copyright © 2013 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
     92        This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.
     93 
     94 SEE ALSO
     95        chmod(2)
     96 
     97        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
     98 
     99               info coreutils 'chmod invocation'
    100 
    101        should give you access to the complete manual.
    102 
    103 
    104 
    105 GNU coreutils 8.22                                                                   October 2018                                                                            CHMOD(1)
    本篇文章出自“国民时代”,转载请注明转载出处。
  • 相关阅读:
    将博客搬至CSDN
    JDBC
    Java刷题常用API
    Java的反射机制
    Java的IO流
    Docker原理:Cgroup
    Docker原理:Namespace
    Anaconda软件安装使用问题
    初步了解Unix系统的I/O模式
    深入理解索引和AVL树、B-树、B+树的关系
  • 原文地址:https://www.cnblogs.com/ChinaGo/p/10596776.html
Copyright © 2011-2022 走看看