- 论坛徽章:
- 0
|
很早就知道umask的意义,就是指创建文件时默认被拿掉的权限(也就是从初始值777中拿掉),但是一直没使用过,昨天在给朋友做FTP的时候才发现,新建立的文件夹权限是755,但是文件就成了644,我的LINUX umask对目录其作用,对文件居然不起作用,不知道是我的理解有错还是怎么的?大家帮帮忙。在此先谢过了。!!
[root@Jes test1]# mkdir test2
[root@Jes test1]# ls -ld test2/
drwxr-xr-x 2 root root 4096 Sep 27 09:31 test2/
[root@Jes test1]# touch test2/test.file
[root@Jes test1]# ls -l test2/test.file
-rw-r--r-- 1 root root 0 Sep 27 09:31 test2/test.file
1 man umask 的相关部分
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins
with a digit, it is interpreted as an octal number; otherwise
it is interpreted as a symbolic mode mask similar to that
accepted by chmod(1). If mode is omitted, the current value of
the mask is printed. The -S option causes the mask to be
printed in symbolic form; the default output is an octal num-
ber. If the -p option is supplied, and mode is omitted, the
output is in a form that may be reused as input. The return
status is 0 if the mode was successfully changed or if no mode
argument was supplied, and false otherwise.
2 我机器的系统版本及默认umask值等信息
[root@Jes ~]# uname -a
Linux Jes 2.6.9-42.EL #1 Wed Jul 12 23:16:43 EDT 2006 i686 i686 i386 GNU/Linux
[root@Jes ~]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
[root@Jes ~]# umask
0022
[root@Jes ~]# umask -S
u=rwx,g=rx,o=rx |
|