博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux命令chown修改文件所有权
阅读量:6767 次
发布时间:2019-06-26

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

  Changing User Ownership  

      To apply appropriate permissions, the first thing to consider is ownership. To do this, there is the  chown  command. The syntax of this command is not hard to understand:    

■    chown who what    
       For instance, the following command changees ownership for the file account to user linda:    
■    chown linda account    
       The  chown  command has a few options, of which one is particularly useful:   -R . You might guess what it does, because this option is available for many other commands as well. It allows you to set ownership recursively, which allows you to set ownership of the current directory and everything below. The following command changes ownership for the directory /home and everything beneath it to user linda:    
■    chown -R linda /home/linda

  Changing Group Ownership  

        There are actually two ways to change group ownership. You can do it using  chown , but there is also a specific command with the name  chgrp  that does the job. If you want to use the  chown  command, use a  .  or  :  in front of the group name. The following changes the group owner of directory /home/account to the group account:    

chown .account /home/account  

       You can use  chown  to change user and/or group ownership in a number of ways, an overview of which follows:    

■   chown lisa myfile     Sets user lisa as the owner of myfile    
■    chown lisa.sales myfile     Sets user lisa as user owner and group sales as group owner of myfile    
■    chown lisa:sales myfile     Sets user lisa as user owner and group sales as group owner of myfile    
■    chown .sales myfile     Sets group sales as group owner of myfile without changing the user owner    
■    chown :sales myfile     Sets group sales as group owner of myfile without changing the user owner    
      You can also use the  chgrp  command to change group ownership. Consider the following example, where you can use  chgrp  to set group ownership for the directory / home/account to the group account:    
■    chgrp account /home/account    
      As is the case for  chown , you can use the option  -R  with  chgrp  as well to change group ownership recursively.  

转载于:https://www.cnblogs.com/rusking/p/5611535.html

你可能感兴趣的文章
数据结构7_链二叉树
查看>>
使用Newtonsoft将DataTable转Json
查看>>
缓存类
查看>>
Spark RDD Transformation 简单用例(三)
查看>>
分治法理论
查看>>
澄甫先生谓古人练拳分四步功夫
查看>>
第八天
查看>>
C# Lambda表达式
查看>>
Android Studio中多项目共享Library
查看>>
用java的io流,将一个文本框的内容反转
查看>>
python: 不同级别的日志输出到不同文件的日志类
查看>>
[LeetCode] Trapping Rain Water
查看>>
linux下下载redis,并且编译
查看>>
FirstOrDefault()的重载方法
查看>>
SumElemet
查看>>
团队编程
查看>>
ajax轮询session阻塞问题
查看>>
C++三大特性之封装
查看>>
【总结整理】WebGIS学习-thinkGIS(三):关于影像金字塔、瓦片行列号、分辨率resolution...
查看>>
冒泡排序的探究
查看>>