博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
chmod命令
阅读量:6868 次
发布时间:2019-06-26

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

hot3.png

权限规则:r=4,w=2,x=1,-=0。

            例:-rwxr-xr-x 755

chmod命令用作修改文件和目录权限。该命令有三种不同语法:

 

1、chmod [-R] xyz 文件名 (这里xyz代表数字)

-R 表示级联更改

[root@localhost~]#touch test.sh

[root@localhost~]# ll test.sh

-rw-r--r-- 1 root root 0 11月 10 08:55 test.sh

[root@localhost~]# chmod 755 test.sh

[root@localhost~]# ll test.sh

-rwxr-xr-x 1 root root 0 11月 10 08:55 test.sh

 

2、因为9个属性分别是user,group,others。所以使用u,g,o代替它们三个的属性。此外,a代表all即全部。

[root@localhost~]# ll test.sh

-rwxr-xr-x 1 root root 0 11月 10 08:55 test.sh

[root@localhost~]# chmod u=rw,g=rw,o=r test.sh

[root@localhost~]# ll test.sh

-rw-rw-r-- 1 root root 0 11月 10 08:55 test.sh

 

3、另外还可以针对u,g,o,a增加或减少某个权限。

[root@localhost~]# ll test.sh

-rw-rw-r-- 1 root root 0 11月 10 08:55 test.sh

[root@localhost~]# chmod u+x,o+x test.sh

[root@localhost~]# ll test.sh

-rwxrw-r-x 1 root root 0 11月 10 08:55 test.sh

 

 

转载于:https://my.oschina.net/u/3017871/blog/785821

你可能感兴趣的文章
移动 web 端屏幕适配 - rem
查看>>
聊聊hystrix的BucketedCounterStream
查看>>
50多种适合机器学习和预测应用的API,你的选择是?(2018年版本)
查看>>
【题目】【4天】寻宝
查看>>
Flutter教程(一) 十分钟了解Flutter
查看>>
maven实战第一步,eclipse创建hello-world项目
查看>>
安装自动化工具ansible
查看>>
手把手教你理解卷积神经网络
查看>>
本地安装sass出错问题解析
查看>>
vue项目优化--使用CDN和Gzip
查看>>
JS练习实例--编写经典小游戏俄罗斯方块
查看>>
简述Linux的启动过程
查看>>
fir.im Weekly - 如何写出零 bug 的代码
查看>>
springboot+postgresql+docker实例
查看>>
[LeetCode] Reverse Vowels of a String
查看>>
Java集合类的排序
查看>>
猴子都能看懂的《Git 分支管理》
查看>>
【面试算法】链表反转
查看>>
Git基本命令学习
查看>>
读书笔记:高性能网站建设
查看>>