码迷,mamicode.com
首页 > 其他好文 > 详细

笔记 3 文件的特殊属性

时间:2016-10-11 22:03:46      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:文件与目录的默认权限与隐藏权限

文件与目录的默认权限与隐藏权限
1.umask:新建文件或者目录时的默认权限
    umask    ##显示系统预留权限值
    umask -S
        u=rwx,g=rx,o=rx                                           ##显示系统的默认创建文件,目录的属性
    [root@localhost ~]# touch file
    [root@localhost ~]# mkdir file1
    [root@localhost ~]# umask
    0022
    [root@localhost ~]# ll -ld ./file ./file1
    -rw-r--r--. 1 root root 0 10月  9 07:58 ./file          ##创建文件时默认属性为666-umask(022)
    drwxr-xr-x. 2 root root 6 10月  9 07:59 ./file1      ##创建目录时默认属性为777-umask(022)
    ***更改umask的值:
        vim /etc/bashrc        71行是普通用户的更改,73是超级用户的更改
        vim /etc/profile    60行是普通用户的更改,62是超级用户的更改
        更改后
        source /etc/bashrc     ##刷新bash配置
        source /etc/profile     ##刷新系统配置预留权限值
        [root@localhost ~]# umask
        0022
        [root@localhost ~]# source /etc/bashrc
        [root@localhost ~]# source /etc/profile
        [root@localhost ~]# umask
        0044            ##成功更改了umask的值
2.特殊权限
    stickyid    ###强制位
    o+t    ###之针对目录,当一个目录上有t权限时,这个目录中的文件只能被文件拥有者删除
    t=1
    chmod o+t directroy
    chmod 1777 directory

    sgid        ###粘制位
    g+s        ##针对目录,在目录中创建的文件都自动归属到目录所在组,针对二进制文件,文件内记    录的程序在执行时和执行者的组身份没有关系,而是以二进制文件的所有组的身份执行的
    chmod g+s file|directory
    chmod 2777 file|directory


    suid        ###冒险位
    u+s        ###针对文件,文件记录动作在执行时是一文件所有人身份执行的,与是谁发起的无关
    chmod u+s file
    chmod 4777 fileg+s

本文出自 “12104576” 博客,请务必保留此出处http://12114576.blog.51cto.com/12104576/1860815

笔记 3 文件的特殊属性

标签:文件与目录的默认权限与隐藏权限

原文地址:http://12114576.blog.51cto.com/12104576/1860815

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!