linux文件权与限之默认权限与隐藏权限

文件权与限之默认权限与隐藏权限

非纯本文件:ob
/bin /usr/bin :普通用户执行的命令
/sbin /usr/sbin :超级用户执行的命令
#cat /usr/bin //会显示乱码
#ob -t type 文件
type:
a 默认字符输出
c 使用ASCLL输出
d 十进制
o 八进制
x 十六进制

ob -t c /usr /bin/passwd

                 //使用ASCLL输出文件

左边第一列以进制

修改文件的时间或创建新文件:touch
mtime :modifcation time
修改文件内容时,更新这个时间
ctime: status time
文件的权限或者属性更改时,修改这个时间
atime: access time
文件内容被取用时,比如cat,更新这个时间

ls -l //显示的时间是

//touch文件时 , 三个时间都会修改问当前的时间
选项:
-a 修改访问时间
-c 仅修改文件时间,文件不存在不创建文件
-d 后面接修改的日期 --tate=“日期和时间”
- m 修改 mtime
-t {YYMMDDhhmm}

cp -a ~/.bashrc bashrc

 	//-a   复制完全属性

[root@localhost tmp]# ll bachrc ; ls - l --time=atime bashrc ; ls - l – time-ctime bashrc
ls: 无法访问bachrc: 没有那个文件或目录
ls: 无法访问-: 没有那个文件或目录
ls: 无法访问l: 没有那个文件或目录
bashrc
ls: 无法访问-: 没有那个文件或目录
ls: 无法访问l: 没有那个文件或目录
ls: 无法访问time-ctime: 没有那个文件或目录
bashrc

[root@localhost tmp]# touch -d "2 day ago " bashrc
[root@localhost tmp]# ll bachrc ; ls - l --time=atime bashrc ; ls - l – time-ctime bashrc
ls: 无法访问bachrc: 没有那个文件或目录
ls: 无法访问-: 没有那个文件或目录
ls: 无法访问l: 没有那个文件或目录
bashrc
ls: 无法访问-: 没有那个文件或目录
ls: 无法访问l: 没有那个文件或目录
ls: 无法访问time-ctime: 没有那个文件或目录
bashrc#

文件的默认权限:umask

umask :

0022 --> 后面三个是一般权限
#umask -s
a=rwx,g=rx,o=rx -->目录的默认权限

1.文件默认不给执行(X)权限,最大666 rw-rw-rw-
2.目录默认给X权限,最大777 rwxrwxrwx
3.uamsk分数值指的是,该默认值需要减掉的权限

#umask 002
#touch b.txt
#ls -l

假设umask为003,文件和目录的权限是什么??
umask 003 ,去掉的权限:---------wx
文件:(-rw-rw-rw-)-(----------wx)–rw-rw-r–
目录:(drwx-rwx-rwx)-(----------wx)-drwxrwxr–
606-002 663

发布了21 篇原创文章 · 获赞 19 · 访问量 76

猜你喜欢

转载自blog.csdn.net/weixin_46575696/article/details/104900564