Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Default permissions for umask- to create files or directories

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

The default permissions of files under linux are determined by the umask value.

Umask defines the default permissions for users to create files or directories through octal values.

Umask corresponds to a value that indicates prohibited permissions. The specific details, files and directories are slightly different.

The default umask for root is 0022

The default umask for the average user is 0002

Files: setting default permissions for users to create files

When umask is even, the default permission to create a file is: file maximum permission minus umask permission

For example, if umask is set to 044, the default permission of the file is 666-044room622, i.e.-rw--w--w-

When umask is odd, the default permission for creating a file is: the maximum permission of the file minus the umask permission, and the resulting odd digit plus 1

Example 1: if umask is set to 045, the default permission of the file is 666-045mm 621, odd digits plus 1, that is, 622, that is,-rw--w--w-

Example 2: if umask is set to 035, the default permission of the file is 666-035mm 631, odd digits plus 1, that is, 642, that is,-rw-r---w-

Directories: setting default permissions for users to create directories

Whether umask is even or odd, using 777-umask directly is the permission of the default directory.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report