Umask difference between 0022 and 022 [closed]

▼魔方 西西 提交于 2019-12-05 09:47:30

问题


Is there any difference between umask 0022 and 022? I want to change my umask to 022. How can I do it?


回答1:


There is no difference between umask 0022 and umask 022.

The octal umasks are calculated via the bitwise AND of the unary complement of the argument using bitwise NOT.

Set the umask like this:

el@apollo:~$ umask 0077
el@apollo:~$ umask
0077
el@apollo:~$ umask 0022
el@apollo:~$ umask
0022

Brief summary of umask value meanings:

umask 077 - Assigns permissions so that only you have read/write access for files, and read/write/search for directories you own. All others have no access permissions to your files or directories.

umask 022 - Assigns permissions so that only you have read/write access for files, and read/write/search for directories you own. All others have read access only to your files, and read/search access to your directories.

umask 002 - Assigns permissions so that only you and members of your group have read/write access to files, and read/write/search access to directories you own. All others have read access only to your files, and read/search to your directories.

For more information about what umask does:

How to set your default umask, see this article: http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html

If you want more detailed information this is an interesting article: http://articles.slicehost.com/2010/7/17/umask-and-unusual-file-permissions-and-types

The answers to this post also offer some insight into umask bits: https://stackoverflow.com/questions/4056912/question-about-umask-in-linux



来源:https://stackoverflow.com/questions/13268796/umask-difference-between-0022-and-022

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!