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. Action class [userAction] not found

    今天在做SSI框架整合的时候报了一个这样的错误:Action class [userAction] not found - action - file:F:\workspace\.metadata\. ...

  2. POJ 2438 (哈密顿回路)

    分析: 2*n个小朋友,每个最多有n-1个"敌人",显然是存在哈密顿回路的. 预处理边,然后找哈密顿回路. code #include <iostream> #incl ...

  3. C++对象数组操作误区

    由于语义上的需要导致语法的上缺陷,所以导致对象数组在C++中存在陷阱. C++语境:一个基类指针或引用是可以指向派生类对象的,以此可来表现C++对运行时多态的需求: 创建一个对象数组将返回首元素的首地 ...

  4. 很久之前写的Ajax库

    很久之前写的一个小型AJAX的js,放在上面以免以后想玩了找不到了. // version : 0.1 beta // author : __Ajax function __Ajax(url,opti ...

  5. mysql主从复制 (超简单) 转载

    怎么安装mysql数据库,这里不说了,只说它的主从复制,步骤如下: 1.主从服务器分别作以下操作:   1.1.版本一致   1.2.初始化表,并在后台启动mysql   1.3.修改root的密码 ...

  6. MYSQL 存储过程1、SQL存储过程的基础知识

    在深入理解MySq之前,我们先理下一些简单的问题 Q:什么是存储过程?(stored procedure) A:是一段写好的SQL代码,特别的就是它是存在数据库的目录里.所以外部程序可以直接调用数据库 ...

  7. PHP简单获取数据库查询结果并返回JSON

    <?php header("Content-type:text/html;charset=utf-8"); //连接数据库 $con = mysql_connect(&quo ...

  8. Libpcap

    http://www.ibm.com/developerworks/cn/linux/l-libpcap/ http://www.linuxdevcenter.com/pub/a/linux/2003 ...

  9. 无聊时,可以去HASKELL里找点感觉

    可以和C,JAVA,PYTHON作任意的比较,感觉越来越晰一些计算机语言里深层的东东... doubleMe x = x + x doubleUs x y = x * + y * doubleSmal ...

  10. JAVA之序列化A

    package SwingGui.sky.com; import java.io.*; public class GameSaverTest { public static void main(Str ...