Provided by: manpages-zh_1.6.3.6-1_all bug

名称

       chown - 更改文件属主与属组

概述

       chown [选项]... [所有者][:[]] 文件...
       chown [选项]... --reference=参考文件 文件...

描述

       This  manual  page  documents the GNU version of chown.  chown changes the user and/or group ownership of
       each given file.  If only an owner (a user name or numeric user ID) is given, that user is made the owner
       of each given file, and the files' group is not changed.  If the owner is followed by a colon and a group
       name (or numeric group ID), with no spaces between them, the group ownership of the files is  changed  as
       well.   If  a colon but no group name follows the user name, that user is made the owner of the files and
       the group of the files is changed to that user's login group.  If the colon and group are given, but  the
       owner  is omitted, only the group of the files is changed; in this case, chown performs the same function
       as chgrp.  If only a colon is given, or if the entire operand is empty, neither the owner nor  the  group
       is changed.

选项

       修改每个文件的所有者和/或所属组为给定的所有者和/或组。如同时使用  --reference,将每个给定文件的所有者和属
       组修改为参考文件所具有的对应值。

       -c, --changes
              类似 verbose 选项,但仅在做出修改时进行报告

       -f, --silent, --quiet
              不显示大多数错误消息

       -v, --verbose
              输出各个处理的文件的诊断信息

       --dereference
              影响每个符号链接的原始引用文件(这是默认行为),而非符号链接本身

       -h, --no-dereference
              只影响符号链接,而非被引用的任何文件(仅当系统支持更改符号链接的所有者时,该选项才有用)

       --from=当前所有者:当前所属组
              只当每个文件的所有者和组符合选项所指定时才更改所有者和组。其中一个可以省略,这时已省略的属性就不需
              要符合原有的属性

       --no-preserve-root
              不特殊对待“/”(默认行为)

       --preserve-root
              不允许在“/”上递归操作

       --reference=参考文件
              使用指定参考文件的所有者和所属组信息,而非手工指定 所有者:组 的值

       -R, --recursive
              递归操作文件和目录

       以下选项是在指定了 -R  选项时被用于设置如何遍历目录结构体系。如果您指定了多于一个选项,那么只有最后一个会
       生效。

       -H     如果命令行参数是一个指向目录的符号链接,则对其进行遍历

       -L     遍历每一个遇到的指向目录的符号链接

       -P     不遍历任何符号链接(默认)

       --help 显示此帮助信息并退出

       --version
              显示版本信息并退出

       如果没有指定所有者,则不会更改所有者信息。若所属组若没有指定也不会对其更改,但当加上  ':' 时 GROUP 会更改
       为指定所有者的主要组。所有者和所属组可以是数字或名称。

范例

       chown root /u
              将 /u 的属主更改为"root"。

       chown root:staff /u
              和上面类似,但同时也将其属组更改为"staff"。

       chown -hR root /u
              将 /u 及其子目录下所有文件的属主更改为"root"。

作者

       由 David MacKenzie 和 Jim Meyering 编写。

报告错误

       GNU coreutils 的在线帮助: <https://www.gnu.org/software/coreutils/>
       请向 <https://translationproject.org/team/zh_CN.html> 报告翻译错误。

版权

       Copyright  ©  2020  Free  Software  Foundation,  Inc.   License  GPLv3+:  GNU  GPL  version  3  or  later
       <https://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.

参见

       chown(2)

       完整文档请见: <https://www.gnu.org/software/coreutils/chown>
       或者在本地使用: info '(coreutils) chowns invocation'

       本页面中文版由中文 man 手册页计划提供。
       中文 man 手册页计划:https://github.com/man-pages-zh/manpages-zh

GNU coreutils 8.32                                 2020年三月                                           CHOWN(1)