APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

The cure for everything - chmod 777

I admit that I have done a "chmod 777" when I should not have. Almost always that came from haste or frustration. Not frustration with Unix permissions, but frustration with whoever had daily care responsibility for the system - their inability to understand permissions might have driven me to this.

Sometimes it hardly matters. At many small businesses, everybody has "got root" anyway and has learned that this magic incantation will "fix" problems. Well, until it breaks a setuid program, of course. Nobody, NOBODY ever learns "chmod +w", do they?

Another rare breakage is /tmp. It's supposed to have the "t" bit set so that only the owners of files can delete, but I've had folks "777" it. Why? Who knows?

More usually the open permissions are applied to some common set of data. All goes well until someone removes (or just moves!) something that is needed by someone else, and then the crying starts.

The most horribly wrong things that can be done with permissions come from people who have learned about "-R" (recursive) or wild cards. Two or three times a year I find a system where someone has done a chmod to ".*". That's bad enough by itself, but when combined with -R, the results can be spectacular.

Unnecessary damage

What you should understand is that this is all unnecessary. Most of us who have to deal with the results of misunderstood chmod's wish that users didn't even know that the numeric form exists. There would be far fewer errors if users only knew the symbolic modes.

The symbolic form is also much more powerful. Consider this :


$ ls -l
total 0
-rw-r--r--  1 apl  apl  0 Oct 27 15:06 a
-rw-r--r--  1 apl  apl  0 Oct 27 15:06 b
-rwxr--r--  1 apl  apl  0 Oct 27 15:10 c

$ chmod a+X  a b c
$ ls -l
total 0
-rw-r--r--  1 apl  apl  0 Oct 27 15:06 a
-rw-r--r--  1 apl  apl  0 Oct 27 15:06 b
-rwxr-xr-x  1 apl  apl  0 Oct 27 15:06 c
 

ONLY the file that was already executable had full execution bits added - try THAT with Windows!

(If you did want to change all the files, you'd use "chmod a+x a b c")

But I'm being silly. People will continue to "chmod 777" anytime they have a problem. Program doesn't work? Chmod 777. Unexpected error? Chmod 777. Grinding noise inside the computer? Chmod 777. Too hot in here? Chmod 777.

Feeling frustrated by people changing permissions for no reason? By now you should know the cure. Say it with me: Chmod 777.

Don't you feel better now?



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> The cure for everything - chmod 777


4 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence







Wed Oct 28 12:45:01 2009: 7367   joe

gravatar
when everything fails often a chmod 777 solves.....
is the case one is in front its own limitations
regards.. sharing the hard life of thecnical support
joe. neuquen patagonia argentina



Thu Oct 29 16:37:37 2009: 7371   anonymous

gravatar
yes! i feel better with chmod 770 on a OSX System with MORE than 1 User on it - the System neves me with created files that have 707 permission set - ahhhhrrgg ! fuc*-*ff






Sun Nov 1 21:13:16 2009: 7409   anonymous

gravatar
Just curious, how I can grant access to a directory like the following within Linux?

* Tom: can read, write, delete, and create new files
* Marcy: can read files but nothing else
* Bill: can write only but not read other data
* Jake: can view directory contents only
* Everyone else: no access



Sun Nov 1 21:45:21 2009: 7410   anonymous

gravatar
By setting ACL's. See the article at (link)

------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Principles have no real force except when one is well-fed. (Mark Twain)

A crowded police docket is the surest of all signs that trade is brisk and money plenty. (Mark Twain)







This post tagged: