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.

linux命令chown修改文件所有权的更多相关文章

  1. Linux 命令 - chown: 更改文件的所有者和所属群组

    chown 命令用来更改文件或者目录的所有者和所属群组.使用这个命令需要超级用户的权限. 命令格式 chown [OPTION]... [OWNER][:[GROUP]] FILE... chown ...

  2. linux中如何修改文件夹的用户权限 chown命令

    linux中,可以使用chown命令来修改文件夹的用户权限. 1.  以普通用户 A 登录linux,利用su -切换到root用户 2. 在root用户下,可以看到文件夹内容 3. 但通过文件系统, ...

  3. linux ,mac连接, git pull error, chmod修改文件的权限/chown修改文件和目录的所有者

    去项目目录下 启动服务 setsid npm start & Mac下如何用SSH连接远程Linux服务器 https://www.cnblogs.com/littleBit/p/536280 ...

  4. linux系统下修改文件夹目录权限

    linux系统下修改文件夹目录权限 文件夹权限问题 Linux.Fedora.Ubuntu修改文件.文件夹权限的方法差不多.很多人开始接触Linux时都很头痛Linux的文件权限问题.这里告诉大家如何 ...

  5. Linux下批量修改文件及文件夹所有者及权限

    Linux下批量修改文件及文件夹所有者及权限需要使用到两个命令,chmod以及chown 例:对/opt/Oracle/目录下的所有文件与子目录执行相同的权限变更: chmod -R 700 /opt ...

  6. 【转】linux查看及修改文件权限以及相关

    linux查看及修改文件权限以及相关 查看文件权限的语句: 在终端输入: ls -l xxx.xxx (xxx.xxx是文件名) 那么就会出现相类似的信息,主要都是这些: -rw-rw-r-- 一共有 ...

  7. Linux命令行修改IP、网关、DNS、主机名 的方法

    修改主机名:[改里面的 HOSTNAME 即可] vim /etc/sysconfig/network 网卡eth0    IP修改为 102.168.0.1 ifconfig eth0 102.16 ...

  8. Linux命令行修改IP、网关、DNS的方法

    Linux中在命令行中修改IP地址.网关.DNS的方法. 网卡eth0    IP修改为 102.168.0.1 复制代码代码如下: ifconfig eth0 102.168.0.1 netmask ...

  9. 分布式进阶(十) linux命令行下载文件以及常用工具:wget、Prozilla、MyGet、Linuxdown、Curl、Axel

    linux命令行下载文件以及常用工具:wget.Prozilla.MyGet.Linuxdown.Curl.Axel 本文介绍常用的几种命令行式的下载工具:wget.Prozilla.MyGet.Li ...

随机推荐

  1. 跟我学android-Android应用结构分析(四)

    自动生成的R.java文件说明 public final class R { public static final class attr { } public static final class ...

  2. aborb()程序结束形式

    abort()与exit()的区别?         分类:             MFC              2011-01-04 14:13     2233人阅读     评论(0)   ...

  3. 利用C++ RAII技术自动回收堆内存

    在C++的编程过程中,我们经常需要申请一块动态内存,然后当用完以后将其释放.通常而言,我们的代码是这样的: 1: void func() 2: { 3: //allocate a dynamic me ...

  4. CSS样式margin:0 auto不居中

    <style type="text/css">html,body{height:100%;width:960px;}.container{background-colo ...

  5. 教你怎样在ppt2010抠图的小技巧|用ppt2010抠图的方法

    我们经常在ppt2010里做幻灯片时会碰到插入的图片并不是我们想要的情况,有的图片只是想要其中的一个部分.我们用“裁剪”功能也是达不到自己想要的效果.有的人会说PS抠图啊,但是比较繁琐,不易懂,不好上 ...

  6. Tr A

    Problem Description A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973. Input 数据的第一行是一个T,表示有T组数据. 每组数据的第 ...

  7. JavaScript注意事项

    var m = "false"; Boolean(m); // true而非 false ajax不能设置setRequestHeaders("Cookie", ...

  8. POJ2115 C Looooops(数论)

    题目链接. 分析: 数论了解的还不算太多,解的时候,碰到了不小的麻烦. 设答案为x,n = (1<<k), 则 (A+C*x) % n == B 即 (A+C*x) ≡ B (mod n) ...

  9. 【转】Android 基于google Zxing实现二维码、条形码扫描,仿微信二维码扫描效果--不错

    原文网址:http://blog.csdn.net/xiaanming/article/details/10163203 转载请注明出处:http://blog.csdn.net/xiaanming/ ...

  10. (转载)PHP使用header函数设置HTTP头的示例方法表头

    (转载)http://justcoding.iteye.com/blog/601117/ 代码: //定义编码 header( 'Content-Type:text/html;charset=utf- ...