DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OSXFAQ Daily Unix Tricks   back to index

Week 47 - Shell Built-ins (9 June 2003)

by Adrian Mayo - Senior Editor for Mac OS X Unix

Wednesday - umask

The umask built-in command tells the file system the default permissions to apply to newly created files and directories. The umask can be set in your tcsh startup file, or applied just to a partiaular Terminal session.

Without a 'umask' directories are set to:

drwxrwxrwx 2 saruman staff 68 Jun 9 11:16 test-dir

and files to:

-rw-rw-rw- 1 saruman staff 0 Jun 9 11:16 test-file

The umask is usually set to 022:

% umask 022
% touch test-file
% ls -al test-file
-rw-r--r--   1 saruman  staff           0 Jun  9 11:22 test-file

Give write access to your group:

% rm test-file
% umask 002
% touch test-file
% ls -al test-file
-rw-rw-r--   1 saruman  staff           0 Jun  9 11:23 test-file

For shared files:

% rm test-file
% umask 000
% touch test-file
% ls -al test-file
-rw-rw-rw-   1 saruman  staff           0 Jun  9 11:23 test-file

For private files:

% rm test-file
% umask 077
% touch test-file
% ls -al test-file
-rw-------   1 saruman  staff           0 Jun  9 11:23 test-file

Discuss this trick in the Learning Center forum


If you want to learn more about Mac OS X Unix visit the Learning Center  click.

  • For beginners: the Mac OS X Unix Tutorial
  • For detailed information on specific topics: Mac OS X Advanced Unix
  • For answers to common problems: Mac OS X How To



Copyright © 2000-2010 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.