From the computer of: qmchenry
(339 recipes)
Created: Sep 19, 2004
See the recipe Set UNIX file access permissions with chmod for the basics of file permissions and chmod. This recipe is for users familiar with these concepts.
The permissions for each user type can be represented by an octal value. Each type of permission carries with it a value:
Putting these together in combination yields an octal number from 0 to 7. For example, read (4) and execute (1) permissions together are represented by 5 (4+1). Here is a table representing all of the possible values:
This seems more complex than using the ug+rw notation covered in the recipe linked above. The character-based syntax is useful for simple changes in file permissions, but it provides only relative changes in state, such that the resulting state is dependent on the values before running chmod. In addition, common real-world requirements can make the character-based syntax very complex.
Using octal syntax for chmod allows setting the absolute permissions for owner, group, and other in one quick command. The syntax requires three octal digits, each representing the owner, group, and other permissions, respectively. For example, to set rwx (7) for owner, r-x (5) for group, and no permissions (0) for other, use the following chmod command:
The learning curve is a little steeper for the octal syntax, but the benefits are great, too.
Subscribe to the Tech-Recipes Newsletter
You can get tips like this delivered in your email every week!
We will never, ever sell your email address or spam you.
1 Recipe comments: View comments
UNIX: advanced octal file permissions with chmod by Anonymous
Related recipes:
Set UNIX file access permissions with chmod
How to empty or clear the contents of an existing UNIX file
Unix/Linux: Easily find or search files or directories
Convert Unix lines breaks to Macintosh line breaks
Copy entire contents of a directory and preserve permissions
Convert DOS line breaks to Unix line breaks
Check the UNIX group database for errors
Ubuntu: Getting KDE 4.0 to Accept Your sudo Password
Convert Macintosh line breaks to Unix line breaks
Solve your UNIX identity crisis
Sponsored links
Login
Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.Search
Tech Recipes
· Home
· Mac OS X
· Solaris
· Windows
· Programming
· UNIX
· Cisco
· MySQL
· Google
· Instant messaging
· Add recipes
· Leave feedback
· Recommend us
· RSS Syndication
Hot recipes
Make XP look like Windows Vista / Longhorn for free!
XP: Small, Free Way to Use and Mount Images (ISO files) Without Burning Them
SMS through E-Mail: Cingular, Nextel, Sprint, T-Mobile, Verizon, Virgin Mobile
Vista: Should I Install 64-bit or 32-bit Version? (x64 vs x86)
How Do I Use or Open Bin, Cue, or ISO Files?
MySpace Hack: View Pictures and Comments on a Private Profile
Hacks to Beat Rapidshare Download Limits and Waiting Time
MySpacé: Hack to Download Any Song on Mysapcé
Who's Online
There are currently, 1913 guest(s) and 0 member(s) that are online.
You are Anonymous user. You can register for free by clicking here
Information
Wish to advertise with us?
All logos and trademarks in this site are property of their respective owner. The comments and forum posts are property of their posters, all the rest © 2003-2007 by QD Ideas, LLC.
Users of this site are legally bound by the Terms and conditions and Disclaimer. Do not use this web site if you do not agree with these policies.
The members, admins, and authors of this website respect your privacy.
Page Generation: 0.84 Seconds
Thu Aug 28 21:14:02 2008