Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it safe to chmod a directory 777, or is it a security risk?

One of my scripts requires that in order to run in multi-user situations, and I'm wondering if it's okay.

share|improve this question
4  
You should set it to group-writable, and world-read-only, and add users to the group as necessary. –  hexafraction Sep 14 '12 at 22:56
    
See also: askubuntu.com/questions/20105/… –  Jorge Castro Sep 15 '12 at 3:35
    
@JorgeCastro: Thanks, although that thread doesn't explain anything I didn't know. Yes, 777 means anyone with access to the filesystem can create and execute a script. But is that exploitable to cause a security problem? Wouldn't someone with access to the filesystem be able to do that even without my 777 directory? –  configurator Sep 15 '12 at 7:55

1 Answer 1

up vote 3 down vote accepted

While it is generally considered to be a bad practice, because any user can remove or modify any other users data, it is not such a great risk in itself; or, better said, it all depends on the context. On a machine with a limited number of trusted users this is not really a problem, as long as the script is not world accessible (like a web cgi) or runs as root.

However, there are many ways such a need can be avoided, and if you post some details (why must the script use 777?), we can consider a better solution. One semi-solution is to set the +t bit; that way, any user can write in the directory, but only that user can then remove or modify the created files.

share|improve this answer
    
I didn't know about the sticky bit, that's actually very helpful. Thanks. –  configurator Sep 14 '12 at 23:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.