Linux之档案管理
2024-10-18 22:25:02
1:档案类型[1]
d :目录
-:档案
l:链接档
b:装置文件中可存储接口设备
c:装置文件中串行设备,例如:键盘,鼠标
2:RWX:
R:read (可读),W:write(可写),X:excute(可执行)
注意:如果文件为目录,无X权限,不可访问目录。
3:改变档案权限
chown:改变档案的拥有者
chgrp:改变档案的所属群组
chmod:改变档案的属性,SUID等
chmod的设置分两种:数字和字符
r:4
w:2
x:1
每3位一组
user :u
group:g
outhers:o
a代表u,g,o 所有
符号:+,-,=
说明:+和-:在原权限基础上增减,=:直接设置目标权限
chown:
[root@zkero ~]# touch test
[root@zkero ~]# ll test
-rw-r--r-- root root Jun : test
[root@zkero ~]# chown supker test
[root@zkero ~]# ll test
-rw-r--r-- supker root Jun : test
chgrp:
[root@zkero ~]# chgrp supker test
[root@zkero ~]# ll test
-rw-r--r-- supker supker Jun : test
chmod:
[root@zkero ~]# ll test
-rw-r--r-- supker supker Jun : test
[root@zkero ~]# chmod test
[root@zkero ~]# ll test
-rwxrwxrwx supker supker Jun : test
[root@zkero ~]# ll test
-rwxrwxrwx supker supker Jun : test
[root@zkero ~]# chmod g=rw,o=- test
[root@zkero ~]# ll test
-rwxrw---- supker supker Jun : test
[root@zkero ~]#
其中o=-,可以写成o=
[root@zkero ~]# ll test
-rw-rw---- supker supker Jun : test
[root@zkero ~]# chmod a+x test
[root@zkero ~]# ll test
-rwxrwx--x supker supker Jun : test Linux 目录配置依据 FHS
参考网址:http://www.pathname.com/fhs/
规范两层:一层是 /
另一个层是 /usr,/var
绝对路径与相对路径
绝对路径:从/开头
相对路径:相对于当前位置的路径
.:当前目录
..:上一层目录
/下目录浏览: [root@zkero ~]# ls -l /
total
dr-xr-xr-x. root root May : bin
dr-xr-xr-x. root root Apr : boot
drwxr-xr-x root root Jun : dev
drwxr-xr-x. root root Jun : etc
drwxr-xr-x. root root Jun : home
dr-xr-xr-x. root root Apr : lib
dr-xr-xr-x. root root May : lib64
drwx------. root root Apr : lost+found
drwxr-xr-x. root root Sep media
drwxr-xr-x. root root Jun : mnt
drwxr-xr-x. root root Apr : opt
dr-xr-xr-x root root Jun : proc
dr-xr-x---. root root Jun : root
dr-xr-xr-x. root root Jun : sbin
drwxr-xr-x. root root Apr : selinux
drwxr-xr-x. root root Sep srv
drwxr-xr-x root root Jun : sys
drwxrwxrwt. root root Jun : tmp
drwxr-xr-x. root root Apr : usr
drwxr-xr-x. root root May : var
其中root目录最好设置成
s:特殊权限:set user id (s), set group id (s), sticky bit (t) 简称sst
set user id (s):执行文件以拥有者的权限执行 4000
set group id (s):执行文件以所属组的权限执行 2000
sticky bit (t):只有拥有者才能删除文件 1000
原来有x属性,加sst,会将x位变成s(s,t);若原来无x属性,则x位变成S(S,T)
举例:
[root@localhost ~]# ls -l test
-rw-r--r--. root root Jul : test
[root@localhost ~]# chmod u+s test
[root@localhost ~]# ls -l test
-rwSr--r--. root root Jul : test
[root@localhost ~]# chmod u+x test
[root@localhost ~]# ls -l test
-rwsr--r--. root root Jul : test
最新文章
- 如何搞定IE+google双内核的360浏览器表单自动回填兼容问题
- 如何创建一个Edge 浏览器扩展
- super
- ASP.NET--GridView配合DetailsView初使用
- 制作Andriod程序的数字签名需要使用JDK
- 百度地图LBS开放平台AK一直没有用
- mybatis()
- C# json
- java 动态获取web应用的部署路径
- FileReader读取文件里文乱码问题
- 2014 CSDN博文大赛终于获奖名单发布
- Linux报too many open files的解决方案
- PHP文件相关函数试题
- HTML5学习指导路线
- 集中式(SVN)和分布式(Git)版本控制系统的简单比较
- 记录最近的几个bug
- 末学者笔记--shell编程上 2 玄
- MySQL数据排序asc、desc
- Oracle中rownum和rowid的理解
- Spring 学习04
热门文章
- 文件 FIFO队列
- 使用oschina的git服务器
- mysql给日期增减
- C++模板元编程 - 1 基本数据类型和运算
- 开发工具及服务年度大奖评选 I Bugtags 荣获最具成长潜力奖
- esriSRProjCS2Type Constants
- SELinux配置不当导致vsftpd系统用户不能登陆
- 用HTML代码加载Unity内容(unity频道:http://unity3d.9ria.com/)
- 自动以读写方式挂载ntfs-黑苹果之路
- 修改 sql server 2008R2的端口,配置防火墙允许远程访问SQL Server 2008 R2