博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
27.chown更换所有者
阅读量:6990 次
发布时间:2019-06-27

本文共 1206 字,大约阅读时间需要 4 分钟。

命令名称

chown

命令描述

变更文件或者目录所属用户

27.chown更换所有者

语法

chown 【参数】【用户:组】 【文件或者目录】

参数

-R 递归

-V显示

案例一:更换文件的所有者和所有组

[root@localhost /]# chown AAA:AAA 1.txt [root@localhost /]# ls1.txt  bbbbb  boot  etc   lib    media  opt   root  sbin  sys  usrAAA    bin    dev   home  lib64  mnt    proc  run   srv   tmp  var[root@localhost /]# ls -l总用量 40-rwxrw-rw-.   1 AAA  AAA  7064 12月 18 16:49 1.txt

案例二:更换指定目录下的所有文件目录和组

[root@localhost /]# chown -Rv AAA:AAA ABCchanged ownership of "ABC/A/B/C/D" from root:root to AAA:AAAchanged ownership of "ABC/A/B/C" from root:root to AAA:AAAchanged ownership of "ABC/A/B" from root:root to AAA:AAAchanged ownership of "ABC/A" from root:root to AAA:AAAchanged ownership of "ABC" from root:root to AAA:AAA[root@localhost /]#

案例三:更换所有组

[root@localhost /]# chown -R :root ABC[root@localhost /]# ls -l总用量 40-rwxrw-rw-.   1 AAA  AAA  7064 12月 18 16:49 1.txtdrwxrwxrwx.   3 root root   16 12月 18 18:40 AAAdrwxr-xr-x.   3 AAA  root   14 12月 18 19:10 ABC

案例四:更换所有者

[root@localhost /]# chown AAA: AAA[root@localhost /]# ls -l总用量 40-rwxrw-rw-.   1 AAA  AAA  7064 12月 18 16:49 1.txtdrwxrwxrwx.   3 AAA  AAA    16 12月 18 18:40 AAA

PS:更换组权限还有一个命令是chgrp ,但是这个命令更换不了用户权限所以用的不多。

转载于:https://blog.51cto.com/sdwaqw/2052675

你可能感兴趣的文章
性能测试基础知识
查看>>
hdu 3466 Proud Merchants 01背包变形
查看>>
Codeforces 623D [Amazing概率题]
查看>>
React 点击删除列表中对应项(React 获取DOM中自定义属性)
查看>>
VIPM 发布功能总结
查看>>
sql server存儲過程語法
查看>>
msbuild ignore project dependencies问题
查看>>
Mysql InnoDB锁
查看>>
Google搜索技巧
查看>>
Android210 调试支持 wince6.0系统
查看>>
Android 开发佳站
查看>>
JSR310 时间类型的相互转换
查看>>
Support Vector Machine (2) : Sequential Minimal Optimization
查看>>
过滤器
查看>>
委托和回调函数例子
查看>>
XML与HTML 区别
查看>>
1312:【例3.4】昆虫繁殖(递推算法)
查看>>
继承,多态,抽象,接口
查看>>
C#ADO.NET基础一
查看>>
一个文字横向滚动的JavaScript文档
查看>>