博客
关于我
linux umask
阅读量:314 次
发布时间:2019-03-03

本文共 426 字,大约阅读时间需要 1 分钟。

拿掉的文件/目录默认权限

umask查看默认权限设置, 为数字形式

参数 -S 查看符号形式

通常

  • 文件默认权限为666
  • 目录默认权限为777

所以umask表示会去掉的权限, 则下图中表示user不被拿掉任何权限, 其他用户被拿掉写权限

r: 4w: 2x: 1

在这里插入图片描述

所以建立文件和目录默认得到的权限就是
666-022 = 644, 777-022 = 755
用各位数相减的方式计算是错误的! 很多人都会想当然这么想, 但是不对!
比如666 - 003 即 rw-rw-rw- - -------wx = rw-rw-r-- = 664
如果是直接相减 = 663 ???
所以相减逻辑上并不对, 因为本来没有的权限减掉的时候应该维持没有的状态, 不会负负得正
应该把数字翻译成符号再进行思考, 不然以后踩坑, 切记

使用就是直接在umask后加一个3位数字表示要拿掉的权限

# exampleumask 003umask 421umask 777

转载地址:http://gsfq.baihongyu.com/

你可能感兴趣的文章
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.7 Parameters vs Hyperparameters
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
nnU-Net 终极指南
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
查看>>
No module named 'crispy_forms'等使用pycharm开发
查看>>
No module named 'pandads'
查看>>
No module named cv2
查看>>
No module named tensorboard.main在安装tensorboardX的时候遇到的问题
查看>>