您的位置:首页 > 职场人生

umask

2012-02-27 08:02 141 查看
umask 指目前用户在新建文件或目录时的默认权限

[root@localhost ~]# umask 以数字形态的权限设置
0022
[root@localhost ~]# umask –S 以符号类型设置文件权限
u=rwx,g=rx,o=rx

Create File:
666-umask

Create Directory:
777-umask
umask 的分数指该默认值需要剪掉的权限

文件特殊权限:SUID,SGID,SBIT
[root@localhost ~]# ls -ld /tmp;ls -l /usr/bin/passwd
drwxrwxrwt 5 root root 4096 Feb 23 20:29 /tmp
-rwsr-xr-x 1 root root 22960 Jul 17 2006 /usr/bin/passwd
当s出现在文件所有者的x权限上时,例如/usr/bin/passwd 文件,此时称之为Set UID,简称为SUID,SUID有这样的功能
1. SUID权限对二进制文件有效
2. 执行者对于该程序需要具有x的可执行权限
3. 本权限仅在执行过程中有效;
4. 执行者将具有该程序所有者的权限
比如我在进行修改密码的时候,我可以暂时获得程序所有者root的权限,可以执行;
SGID可以针对文件目录进行设置,SGID有如下功能
1. SGI对二进制文件有用
2. 程序执行者对于该程序来说,需具备x的执行权限
3. 执行者在执行的过程中将会获得该程序用户组的支持。
用户在对于此目录有r与x权限时,可以进入该目录;用户在此目录下的有效用户组则变成该目录的用户组,若用户在此目录具有w的权限,则用户所创建新文件的用户组与此目录的用户组相同。
Sticky Bit
当用户对于此目录有w,x权限时,即具有写入的权限,则该用户在该目录下创建目录和文件只有自己和root用户才有权利删除该文件。
可以通过使用chmod 命令来更改文件的权限。
[root@localhost tmp]# chmod 4755 test ;ls -l test
-rwsr-xr-x 1 root root 0 Feb 23 21:14 test
[root@localhost tmp]# chmod 6755 test;ls -l test
-rwsr-sr-x 1 root root 0 Feb 23 21:14 test
[root@localhost tmp]# chmod 1755 test
[root@localhost tmp]# ll test
-rwxr-xr-t 1 root root 0 Feb 23 21:14 test
[root@localhost tmp]# chmod 7666 test ;ll test
-rwSrwSrwT 1 root root 0 Feb 23 21:14 test
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  职场 休闲 umask