chown更改文件或目录的属主和属组

一、chown的作用:更改文件或目录的属主和属组

二、语法:chown  user:group  filename    #更改文件的属主和属组

                  chown  user  filename              #更改文件的属主

                  chown :group  filename            #更改文件的属组

  例如:

 [ldyabl@localhost ~]$ touch  {a,b,c}.txt

 [ldyabl@localhost ~]$ ll *.txt
 -rw-rw-r-- 1 ldyabl ldyabl 0 2月  27 22:35 a.txt
 -rw-rw-r-- 1 ldyabl ldyabl 0 2月  27 22:35 b.txt
 -rw-rw-r-- 1 ldyabl ldyabl 0 2月  27 22:35 c.txt 

[ldyabl@localhost ~]$ chown ldyabl:ldyabl a.txt
[ldyabl@localhost ~]$ ll a.txt

-rw-rw-r-- 1 ldyabl ldyabl 0 2月  27 22:35 a.txt

[root@localhost ldyabl]# chown :root a.txt

[root@localhost ldyabl]# ll a.txt
-rw-rw-r-- 1 ldyabl root 0 2月  27 22:35 a.txt

                  

猜你喜欢

转载自blog.csdn.net/qq_42289214/article/details/87994536