Linux文件/目录的权限及归属管理详述(2)

控制新建的文件或目录的权限,默认权限去除umask的权限就是新建的文件或者目录的权限。

2、设置umask umask 022 3、查看umask umask 4、应用举例: [root@centos01 ~]# umask <!--查看umask--> 0022 [root@centos01 ~]# umask 000 <!--设置umask为000--> [root@centos01 ~]# umask <!--验证是否设置成功--> 0000 [root@centos01 ~]# touch 2.txt <!--创建新文件--> [root@centos01 ~]# ll 总用量 8 -rwxr-xr-x 1 bob benet 0 1月 17 03:48 1.txt -rw-rw-rw- 1 root root 0 1月 17 03:48 2.txt <!--查看权限--> -rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg -rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg [root@centos01 ~]# umask 022 <!--设置umask为022--> [root@centos01 ~]# umask <!--查看umask--> 0022 [root@centos01 ~]# touch 3.txt <!--再次创建新文件--> [root@centos01 ~]# ll 总用量 8 -rwxr-xr-x 1 bob benet 0 1月 17 03:48 1.txt -rw-rw-rw- 1 root root 0 1月 17 03:48 2.txt -rw-r--r-- 1 root root 0 1月 17 03:49 3.txt <!--查看权限,明显不一样--> -rw-------. 1 root root 1572 10月 23 22:37 anaconda-ks.cfg -rw-r--r--. 1 root root 1603 10月 23 23:36 initial-setup-ks.cfg

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/11551.html