chown 中文man页面

系统
chown 修改每个由第一个非选项参数声明的给定 file(文件) 的用户和/或组的所有权.如下: 如果只给出了用户名(或者数字用户标识),那么该用户即成为每个指定文件的所有者,而该文件的组别并不改变.如果用户名后面紧跟着冒号和组名(或者是数字组标识),并且它们之间没有空格,那么文件的组所有权也随之改变.

名字

chown - 修改文件所有者和组别  

总览

chown [options] user [:group] file...

POSIX 选项: [-R]

GNU 选项(最短格式): [-cfhvR] [--dereference] [--reference=rfile] [--help] [--version] [--]  

描述

chown 修改每个由***个非选项参数声明的给定 file(文件) 的用户和/或组的所有权.如下: 如果只给出了用户名(或者数字用户标识),那么该用户即成为每个指定文件的所有者,而该文件的组别并不改变.如果用户名后面紧跟着冒号和组名(或者是数字组标识),并且它们之间没有空格,那么文件的组所有权也随之改变.  

GNU细节

GNU版本允许使用一个点来替代冒号(学BSD的).[因为点是有效的用户名中的字符,所以这不被POSIX所接纳.]如果有一个冒号或者点,却没有组名跟在用户名后,那么该用户即成为文件的所有者,而且文件的组改为该用户的登录组.如果给定了冒号或者点,以及组,但是省略了用户名,那么只有文件的组被修改;在这种情况下, chown 执行的是与 chgrp 相同的功能.  

POSIX选项

-R
递归地修改目录及其下面内容的所有权.

GNU选项

-c, --changes
详尽地描述每个 file 实际改变了哪些所有权.
-f, --silent, --quiet
不打印文件所有权不能修改的报错信息.
-h, --no-dereference
只作用于其本身的符号链接,而不修改它们所指向的文件. 这只在提供了 lchown 系统调用的情况下才可用.
-v, --verbose
详尽地描述对每个 file 所执行的操作(或者无操作).
-R, --recursive
递归地修改目录及其下面内容的所有权.
--dereference
修改符号链接目标端的所有权,而非符号链接自身. (fileutils 4.0中实现的新功能.)
--reference=rfile
(fileutils 4.0中实现的新功能.) 修改 file 的所有权为 rfile 的所有权.

GNU标准选项

--help
在标准输出上打印一条用法信息,并以成功状态退出.
--version
在标准输出上打印版本信息,然后以成功状态退出.
--
终止选项列表.

环境变量

变量LANG, LC_ALL, LC_CTYPE和LC_MESSAGES取其常用义.  

遵循

POSIX 1003.2不允许使用点作为用户名和组名的分隔符.  

备注

本页描述了包括在fileutils-4.0包中的 chown; 其它版本会有细微差别. 请将您的修正和增补建议发到aeb@cwi.nl. 程序中的bugs请报告到 fileutils-bugs@gnu.ai.mit.edu.  

#p#

NAME

chown - change file owner and group  

SYNOPSIS

chown [OPTION]... OWNER[:[GROUP]] FILE...
chown [OPTION]... :GROUP FILE...
chown [OPTION]... --reference=RFILE FILE...  

DESCRIPTION

This manual page documents the GNU version of chown. chown changes the user and/or group ownership of each given file, according to its first non-option argument, which is interpreted as follows. If only 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 user name is followed by a colon or dot 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 or dot 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 or dot and group are given, but the user name is omitted, only the group of the files is changed; in this case, chown performs the same function as chgrp.  

OPTIONS

Change the owner and/or group of each FILE to OWNER and/or GROUP. With --reference, change the owner and group of each FILE to those of RFILE.

-c, --changes
like verbose but report only when a change is made
--dereference
affect the referent of each symbolic link, rather than the symbolic link itself (this is the default)
-h, --no-dereference
affect each symbolic link instead of any referenced file (useful only on systems that can change the ownership of a symlink)
--from=CURRENT_OWNER:CURRENT_GROUP
change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute.
--no-preserve-root do not treat `/' specially (the default)
--preserve-root
fail to operate recursively on `/'
-f, --silent, --quiet
suppress most error messages
--reference=RFILE
use RFILE's owner and group rather than the specifying OWNER:GROUP values
-R, --recursive
operate on files and directories recursively
-v, --verbose
output a diagnostic for every file processed

The following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, only the final one takes effect.

-H
if a command line argument is a symbolic link to a directory, traverse it
-L
traverse every symbolic link to a directory encountered
-P
do not traverse any symbolic links (default)
--help
display this help and exit
--version
output version information and exit

Owner is unchanged if missing. Group is unchanged if missing, but changed to login group if implied by a `:'. OWNER and GROUP may be numeric as well as symbolic.  

AUTHOR

Written by David MacKenzie and Jim Meyering.  

REPORTING BUGS

Report bugs to <bug-coreutils@gnu.org>.  

COPYRIGHT

Copyright © 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

SEE ALSO

The full documentation for chown is maintained as a Texinfo manual. If the info and chown programs are properly installed at your site, the command

info coreutils chown

should give you access to the complete manual.

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:39:42

fcloseall中文man

2011-08-25 15:00:15

cfgetispeed中文man

2011-08-19 18:35:50

issue中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 17:40:25

setvbuf中文man

2011-08-23 14:21:16

poweroff中文man

2011-08-24 15:52:59

intro中文man

2011-08-23 13:40:31

2011-08-25 15:54:08

ferror中文man

2011-08-25 14:40:27

basename中文man

2011-08-25 17:24:54

puts中文man

2011-08-25 18:34:55

ungetc中文man

2011-08-23 10:03:40

useradd中文man

2011-08-23 16:24:57

smbmnt中文man

2011-08-23 10:29:02

chpasswd中文man

2011-08-23 10:34:22

convertquot中文man
点赞
收藏

51CTO技术栈公众号