chown将指定文件的拥有者改为指定的用户或组,用户可以是用户名或者用户ID;组可以是组名或者组ID;文件是以空格分开的要改变权限的文件列表,支持通配符。

chown常见命令参数

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.
-c, --changes like verbose but report only when a change is made
--dereference affect the referent of each symbolic link (this is
the default), rather than the symbolic link itself
-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
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
Examples:
chown root /u Change the owner of /u to "root".
chown root:staff /u Likewise, but also change its group to "staff".
chown -hR root /u Change the owner of /u and subfiles to "root".

常用的命令展示

改变文件拥有者和群组

chown omd: h.txt 【默认是当前用户所在的属组】
chown omd:users h.txt

Linux chown命令详解的更多相关文章

  1. Linux chown命令详解使用格式和方法

    指令名称 : chown 使用权限 : root(一般来说,这个指令只有是由系统管理者(root)所使用,一般使用者没有权限可以改变别人的文件拥有者,也没有权限可以自己的文件拥有者改设为别人.只有系统 ...

  2. linux shell 脚本攻略学习12--文件权限详解,chmod命令详解,chown命令详解,chattr命令详解

    文件权限详解 一.chmod命令详解 文件权限和所有权是Unix/Linux文件系统最显著的特征之一.linux中的每一个文件都与多种权限类型相关联,在这些权限中主要分类为3种: 用户(User)是文 ...

  3. linux chmod 命令详解(转)

    Ubuntu下修改目录权限需要先用 sudo 来获得管理员权限,格式如下: sudo chmod 600 ××× (只有所有者有读和写的权限)sudo chmod 644 ××× (所有者有读和写的权 ...

  4. linux awk命令详解

    linux awk命令详解 简介 awk是一个强大的文本分析工具,相对于grep的查找,sed的编辑,awk在其对数据分析并生成报告时,显得尤为强大.简单来说awk就是把文件逐行的读入,以空格为默认分 ...

  5. linux cat 命令详解

    linux cat 命令详解 http://linux.chinaunix.net/techdoc/system/2007/11/16/972467.shtml adb shell su //这个不一 ...

  6. 【初级】linux rm 命令详解及使用方法实战

    rm:删除命令 前言: windows中的删除命令大家都不陌生,linux中的删除命令和windows中有一个共同特点,那就是危险,前两篇linux mkdir 命令详解及使用方法实战[初级]中我们就 ...

  7. Linux netstat命令详解

    Linux netstat命令详解 一  简介 Netstat 命令用于显示各种网络相关信息,如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多 ...

  8. linux grep命令详解

    linux grep命令详解 简介 grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来 ...

  9. Linux chmod命令详解

    Linux chmod命令详解 chmod----改变一个或多个文件的存取模式(mode)   chmod [options] mode files   只能文件属主或特权用户才能使用该功能来改变文件 ...

随机推荐

  1. vue view 表单验证正常逻辑

    <template> <Form ref="formInline" :model="formInline" :rules="rule ...

  2. 使用Koa2搭建web项目

    随着Node.js的日益火热,各种框架开始层出不穷的涌现出来,Node.js也开始逐渐的被应用到处理服务端请求的场景中.搭建Web项目的框架也随之开始出现——express.koa.koa2.egg等 ...

  3. 入坑python 自己写的小工具,纪念一下

    这个程序的功能是可以从表格中读取某一列数据,传到IDs 这一个参数里,然后在url中获取相应的请求值,并打印 import urllib.request import json import xlrd ...

  4. layui框架使用总结

    最近一个后台系统使用layui框架做的,遇到好多坑在这里总结一下. 1.layui的基本使用,下面的在他下面写,其他的事件也要在这个里面写     行内onclick事件是监听不到写在下面这种代码中的 ...

  5. css揭秘

    一:渐变 线性渐变(Linear Gradients)- 向下/向上/向左/向右/对角方向       background: linear-gradient(direction, color-sto ...

  6. Node.js构建可扩展的Web应用1

    <Practical Node.js:Building Real-World Scalable Web Apps>[美]Azat Mardan(电子工业出版社) 安装node.js和NPM ...

  7. Microsoft .NET Pet Shop 4: Migrating an ASP.NET 1.1 Application to 2.0

    249 out of 297 rated this helpful - Rate this topic Gregory Leake Microsoft Corporation Alan Le, Ale ...

  8. 防止TableView 上的tap手势隔断 cell的选择

    遵循UIGestureRecognizerDelegate协议: 1.0添加手势   - (void)addTapGest {    UITapGestureRecognizer *tap = [[U ...

  9. iOS 关于Xcode上的Other linker flags

    Targets选项下有Other linker flags的设置,用来填写XCode的链接器参数,如:-ObjC -all_load -force_load等.还记得我们在学习C程序的时候,从C代码到 ...

  10. python中闭包和装饰器的理解(关于python中闭包和装饰器解释最好的文章)

    转载:http://python.jobbole.com/81683/ 呵呵!作为一名教python的老师,我发现学生们基本上一开始很难搞定python的装饰器,也许因为装饰器确实很难懂.搞定装饰器需 ...