linux命令chown修改文件所有权
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修改文件所有权的更多相关文章
- Linux 命令 - chown: 更改文件的所有者和所属群组
chown 命令用来更改文件或者目录的所有者和所属群组.使用这个命令需要超级用户的权限. 命令格式 chown [OPTION]... [OWNER][:[GROUP]] FILE... chown ...
- linux中如何修改文件夹的用户权限 chown命令
linux中,可以使用chown命令来修改文件夹的用户权限. 1. 以普通用户 A 登录linux,利用su -切换到root用户 2. 在root用户下,可以看到文件夹内容 3. 但通过文件系统, ...
- linux ,mac连接, git pull error, chmod修改文件的权限/chown修改文件和目录的所有者
去项目目录下 启动服务 setsid npm start & Mac下如何用SSH连接远程Linux服务器 https://www.cnblogs.com/littleBit/p/536280 ...
- linux系统下修改文件夹目录权限
linux系统下修改文件夹目录权限 文件夹权限问题 Linux.Fedora.Ubuntu修改文件.文件夹权限的方法差不多.很多人开始接触Linux时都很头痛Linux的文件权限问题.这里告诉大家如何 ...
- Linux下批量修改文件及文件夹所有者及权限
Linux下批量修改文件及文件夹所有者及权限需要使用到两个命令,chmod以及chown 例:对/opt/Oracle/目录下的所有文件与子目录执行相同的权限变更: chmod -R 700 /opt ...
- 【转】linux查看及修改文件权限以及相关
linux查看及修改文件权限以及相关 查看文件权限的语句: 在终端输入: ls -l xxx.xxx (xxx.xxx是文件名) 那么就会出现相类似的信息,主要都是这些: -rw-rw-r-- 一共有 ...
- Linux命令行修改IP、网关、DNS、主机名 的方法
修改主机名:[改里面的 HOSTNAME 即可] vim /etc/sysconfig/network 网卡eth0 IP修改为 102.168.0.1 ifconfig eth0 102.16 ...
- Linux命令行修改IP、网关、DNS的方法
Linux中在命令行中修改IP地址.网关.DNS的方法. 网卡eth0 IP修改为 102.168.0.1 复制代码代码如下: ifconfig eth0 102.168.0.1 netmask ...
- 分布式进阶(十) linux命令行下载文件以及常用工具:wget、Prozilla、MyGet、Linuxdown、Curl、Axel
linux命令行下载文件以及常用工具:wget.Prozilla.MyGet.Linuxdown.Curl.Axel 本文介绍常用的几种命令行式的下载工具:wget.Prozilla.MyGet.Li ...
随机推荐
- (转载)div最小宽度和自适应的实现方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 136 Single Number(找唯一数Medium)
题目意思:一个int数组,有一个数只出现一次,其他数均出现两次,找到这个唯一数 知识普及:~:非运算,单目运算符1为0,0为1; &:与运算,都为1则为1,否则为0 |:或运算,全为0则为 ...
- [C#] 用一种更优美的方式来替换掉又多又长的switch-case代码段
switch-case语句是我们编码过程中常用的一种分支语句.然而正所谓成也萧何败萧何,每当我们向一个已经拥有了成百上千行的switch-case代码段中添加新的case分支的时候,我们是否有过为代码 ...
- 10:Hello, World!的大小
总时间限制: 1000ms 内存限制: 65536kB 描述 还记得在上一章里,我们曾经输出过的“Hello, World!”吗? 它虽然不是本章所涉及的基本数据类型的数据,但我们同样可以用siz ...
- RESTful API -备
网络应用程序,分为前端和后端两个部分.当前的发展趋势,就是前端设备层出不穷(手机.平板.桌面电脑.其他专用设备......). 因此,必须有一种统一的机制,方便不同的前端设备与后端进行通信.这导致AP ...
- spring framework 4 源码阅读
前面写了几篇spring 的介绍文章,感觉与主题不是很切合.重新整理下思路,从更容易理解的角度来写下文章. spring 的骨架 spring 的骨架,也是spring 的核心包.主要包含三个内容 1 ...
- 【转】Java 中字符串的格式化
原文网址:http://blog.csdn.net/aimartt/article/details/8307237 参考资料:JDK API 1.6.0 中文文档 1.格式字符串语法 产生格式化输出的 ...
- topcoder13185 TreePuzzle
https://community.topcoder.com/stat?c=problem_statement&pm=13185 被wck屠了. 考试时候想分类讨论,结果发现情况有点复杂,最后 ...
- ObsoleteAttribute 可适用于除程序集、模块、参数或返回值以外的所有程序元素。 将元素标记为过时可以通知用户:该元素在产品的未来版本中将被移除。
官方文档:https://msdn.microsoft.com/zh-cn/library/system.obsoleteattribute(v=vs.110).aspx 备注 ObsoleteAtt ...
- JS 实现显示和隐藏div(以百度地图为例)
主要参考的文章:https://my.oschina.net/xsh1208/blog/215811,https://zhidao.baidu.com/question/568774688.html ...