首页 技术 正文
技术 2022年11月14日
0 收藏 802 点赞 4,091 浏览 2075 个字

Linux之档案管理

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
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,954
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,479
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,291
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,108
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,740
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,774