- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- umask and file permission
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 06:28 AM
09-03-2008 06:28 AM
umask and file permission
we know default file permission is 666 and umask is 022... which absolutely fine... when i create any new file i get 666-022 which is 644 _rw_r_ _ r_ _
but when i set the umask to 033 or 055 then this calculation is not working fine...
that is for umask of 033 the file permission should be 666-033 which is 633 _rw_ _wx_wx but the new file permission still remainst to be _rw_r_ _r_ _, the same is for umask 055
Please help
vinod
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 07:01 AM
09-03-2008 07:01 AM
Re: umask and file permission
For directories, the default is 777 since all directories need the execute bit set for searching.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 07:18 AM
09-03-2008 07:18 AM
Re: umask and file permission
r = 4
w = 2
x = 1
If files have a default perm of 666 that would be rw-rw-rw-. So a umask of 033 would say remove w and x from the file. Being that the newly created file would not have the execute bit set there is nothing to take away. So you should get rw-r--r--. The only thing being taken away is writes for the group and other. I hope that made sense. If you think about it, it makes sense.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 07:22 AM
09-03-2008 07:22 AM
Re: umask and file permission
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 07:24 AM
09-03-2008 07:24 AM
Re: umask and file permission
7 = 0111 (-rwx)
6 = 0110 (-rw-)
5 = 0101 (-r-x)
3 = 0011 (--wx)
2 = 0010 (--w-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 12:38 PM
09-03-2008 12:38 PM
Re: umask and file permission
Dear Vinod
file permission
rwx where r is read =4
w for write =2
x is execute =1
4+2+1=7 this is file permssion
and please read the above threads regarding umask
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 10:32 PM
09-03-2008 10:32 PM
Re: umask and file permission
Right. It is value & ~umask_value. No need for complicated explanations, let the hardware do the work:
$ typeset -i8 x=0
$ (( x = 8#666 & ~8#22 ))
$ echo $x
8#644
$ (( x = 8#666 & ~8#33 ))
$ echo $x
8#644
$ (( x = 8#777 & ~8#33 ))
$ echo $x
8#744
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2008 05:17 AM
09-04-2008 05:17 AM
Re: umask and file permission
In keeping with Dennis's suggestion, but using Perl (of course):
# perl -e 'printf "%4o\n",(0666&~022)'
644
# perl -e 'printf "%4o\n",(0666&~027)'
640
Regards!
...JRF...