关于chown命令:
系统管理员使用Chown命令以更改Linux文件系统上的文件和目录的所有权。
它允许超级用户更改和限制对Linux系统上的文件和目录的访问权限。
例子:
以下是如何运行和使用ubuntu Linux的智能的一些示例。
运行以下命令设置john成为Confidential的所有者。
chown john Confidential
设置Confidential的所有者为john,所有组为private
chown john:private Confidential
如果我们未登为root帐户,则可能必须使用sudo命令。
sudo chown john:private Confidential
要更改整个目录的所有权和组,包括子目录,请添加-r选项。
sudo chown -R john:private directories
使用-help选项:
Usage: chown [OPTION]. [OWNER][:[GROUP]] FILE. or: chown [OPTION]. --reference=RFILE FILE. 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 -f, --silent, --quiet suppress most error messages -v, --verbose output a diagnostic for every file processed --dereference affect the referent of each symbolic link (this is the default), rather than the symbolic link itself -h, --no-dereference affect symbolic links 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 '/' --reference=RFILE use RFILE's owner and group rather than specifying OWNER:GROUP values -R, --recursive operate on files and directories recursively 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 an
语法:
以下是如何使用Chown 命令的示例语法。
chown [OPTION]. [OWNER][:[GROUP]] FILE.
选项:
FILE | 要更改权限的文件 |
---|---|
-c, -changes | 使用-c或者-changes选项仅在更改时报告 |
-f, -silent, -quiet | 使用-f或者-silent,-quiet抑制大多数错误消息 |
-R, -recursive | 使用-r或者-rocurnurive选项递归地在文件和目录上运行 |
-v, -verbose | 使用-v或者-verbose选项输出处理的每个文件的诊断 |
-h, -help | 显示此帮助消息并退出 |
日期:2020-07-07 20:55:58 来源:oir作者:oir