Solved

Say I have a umask of 44 what will be the permissions of newly created file myfile

Posted on 2010-11-28
5
1,059 Views
Last Modified: 2012-05-10
Say I have a umask of 44 what will be the permissions of newly created file myfile
0
Comment
Question by:sobeservices2
5 Comments
 
LVL 11

Expert Comment

by:dougaug
ID: 34226145
user = rw
group = w
others = w

rw- -w- -w-
0
 

Author Comment

by:sobeservices2
ID: 34226166
dougaug could you explain your answer a little more

umask creates directory permissions right?

not file permissions?
0
 

Assisted Solution

by:tomy123
tomy123 earned 166 total points
ID: 34226325
When you set the umask as 44 then the default permission for directories will be as follows
u=rwx,g=wx,o=wx

user- read,write,and execute
group-write and execute
others- write and execute

For the case of files the permission will be as follows
rw--w--w-

User- read and write
group = write
others = write

0
 
LVL 11

Accepted Solution

by:
dougaug earned 167 total points
ID: 34226357
When creating files or directories in unix systems, unix combine full access modes for files and directories with "inverted" user mask like below to set permissions (full access mode for files is u=rw-,g=rw-,o=rw- or 666 in octal and for directories it is u=rwx,g=rwx,o=rwx or 777 in octal).

umask=044 (in binary 000 100 100) -> First octet is for owner permissions, second is for group and third for others. First byte (from left to right) is for read permission, second is for write and third is for execute.

When creating a file:
full access mode           = 666 (in binary 110 110 110)
umask                           = 044 (in binary 000 100 100)
Inverting bits in umask = 633 (in binary 111 011 011)

Set file permissions bitwise anding full access mode with inverted umask:
full access mode -> 110 110 110
bitwise and
Inverted umask  -> 111 011 011
permissions        -> 110 010 010
                                rw- -w-  -w-


When creating a directory:
full access mode           = 777 (in binary 111 111 111)
umask                           = 044 (in binary 000 100 100)
Inverting bits in umask = 633 (in binary 111 011 011)

Set file permissions bitwise anding full access mode with inverted umask:
full access mode -> 111 111 111
bitwise and
Inverted umask  -> 111 011 011
permissions        -> 111 011 011
                                rwx -wx -wx
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 167 total points
ID: 34226540
Easiest way to work it out is either by just trying it, or doing the calculation

For a file it's

666
044
-----
622

For a directory it's

777
044
-----
733
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now