Chinaunix首页 | 论坛 | 博客
  • 博客访问: 36293
  • 博文数量: 12
  • 博客积分: 1503
  • 博客等级: 上尉
  • 技术积分: 130
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-04 12:16
文章分类

全部博文(12)

文章存档

2012年(1)

2011年(3)

2010年(2)

2009年(6)

我的朋友

分类: LINUX

2009-08-19 14:29:56

umask (abbreviated from user mask) is a and a in environments that sets the file mode creation mask of the current . The file mode creation mask (also known as the umask) limits the for files and directories subsequently created by the process. When a or other program is creating a file or directory, it specifies the permissions to be granted. The operating system then removes from those the permissions that the file mode creation mask does not allow.
--------from
umask就是对文件访问权限的限制。允许你设定文件创建时的缺省模式,对应每一类用户(文件属主、同组用户、其他用户)存在一个相应的umask值中的数字。对于文件来说,这一数字的最大值分别是6,因为系统不允许你在创建一个文本文件时就赋予它执行权限,必须在创建后用chmod命令增加这一权限。目录则允许设置执行权限,这样针对目录 来说,中各个数字最大可以到7 该命令的一般形式为:umask nnn

其中nnn为umask置000 – 777。

下面是umask值与权限的对照表:
umask 文件 目录
——————–
0 6 7
1 6 6
2 4 5
3 4 4
4 2 3
5 2 2
6 0 1
7 0 0
——————–

从表中可知,对于文件的权限,并不是简单的7-n,而是当n是偶数时,就6-n,当n是奇数时,就是7-n,为什么呢?前面其实已经讲了,就是系统不允许你在创建一个文本文件时就赋予它执行权限,必须在创建后用chmod命令增加这一权限,所以文件的执行位(二进制??1)就不能设置了。如:umask值为022,则默认目录权限为755,默认文件权限为644。

注意,以上的只在linux的文件系统启作用,当自己手动mount一个FAT分区时,它就不分文件还是文件夹了,都是取反即7-n民。


阅读(528) | 评论(0) | 转发(0) |
0

上一篇:啊 生活

下一篇:port scan using UDP

给主人留下些什么吧!~~