- 論壇徽章:
- 0
|
很早就知道umask的意義,就是指創(chuàng)建文件時默認(rèn)被拿掉的權(quán)限(也就是從初始值777中拿掉),但是一直沒使用過,昨天在給朋友做FTP的時候才發(fā)現(xiàn),新建立的文件夾權(quán)限是755,但是文件就成了644,我的LINUX umask對目錄其作用,對文件居然不起作用,不知道是我的理解有錯還是怎么的?大家?guī)蛶兔。在此先謝過了。!
[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 的相關(guān)部分
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 我機(jī)器的系統(tǒng)版本及默認(rèn)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 |
|