UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old June 24th, 2004, 06:24 PM
SysAd_babe SysAd_babe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Philippines
Posts: 14 SysAd_babe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 22 sec
Reputation Power: 0
Question umask problem

Hi, i'm having a problem with umask command.
I set the .profile of user01 to have umask 002.
When user01 creates a directory file using "mkdir" command, the permission of the directory file is rwx-rwx-rw, which correct, bcoz the umask 002. But the problem is, when user01 tried to create a file using "touch" command, the permission of the created file is -rw-rw-r--, which is not correct. Please help me solve this. Thanks in advance.

Reply With Quote
  #2  
Old June 24th, 2004, 07:05 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,337 Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 13 h 14 m 17 sec
Reputation Power: 674
Quote:
Originally Posted by SysAd_babe
Hi, i'm having a problem with umask command.
I set the .profile of user01 to have umask 002.
When user01 creates a directory file using "mkdir" command, the permission of the directory file is rwx-rwx-rw, which correct, bcoz the umask 002.

This is incorrect. It should be:
drwxrwxr-x
because umask 002 will mask out the write bit. You mask out the execute bit with a umask of 001.

BTW as a test, I did do it on my machine with umask of 002. The directory came out with drwxrwxr-x and a file I touched came out with -rw-rw-r-- as expected. OS: FreeBSD 4.10 and shell: tcsh.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month

Reply With Quote
  #3  
Old June 24th, 2004, 08:21 PM
SysAd_babe SysAd_babe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Philippines
Posts: 14 SysAd_babe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 22 sec
Reputation Power: 0
sorry, there have been mistakes on my thread. the permission of the directory file which user01 created is drwxrwxr-x, and the touched file created is -rw-rw-r--, and this is my problem. i set the .profile of user01 with umask 002, so that the files created should have a permission of rwxrwxr-x, is this possible? thnx.

Reply With Quote
  #4  
Old June 24th, 2004, 11:07 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,337 Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 13 h 14 m 17 sec
Reputation Power: 674
No, it is not possible to do this. Don't feel bad about this, a lot of people don't know how umask really works. Basically, any command/application is free to create files with appropriate permissions. For example, compilers normally would create executable files with -rwxrwxrwx and mkdir sets the same permissions to directories that it creates. touch creates files with permissions -rw-rw-rw-. Same with text editors -- there's no need for such applications to set the execute bit, because the files that they produce are usually non-executable by default. All that umask does is turn off certain bits that are enabled by default by the application/command. The umask does NOT turn on bits that are set off by default, by the application. What this means is that since touch never sets the executable bit by default, it isn't going to get magically turned on by the umask.

Hope this all makes sense

Last edited by Scorpions4ever : June 24th, 2004 at 11:10 PM.

Reply With Quote
  #5  
Old June 24th, 2004, 11:51 PM
SysAd_babe SysAd_babe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Philippines
Posts: 14 SysAd_babe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 22 sec
Reputation Power: 0
Oh i see, tnx so much.

Reply With Quote
  #6  
Old June 25th, 2004, 05:54 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
yeah thanks. very detailed. Those small but ever so important little tidbits of information that come in extremely handy under certain circumstances....

-Steven
__________________
No. No, not really, the only change is if you could go and put your face in some manure and follow along at a reasonable distance, that would be fine. –Edmund Black Adder

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > umask problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway