3 ms·
It could also eliminate a race condition.
by dllthomas 6y ago
It could also eliminate a race condition.
- adrianmonk 6y agoGood point. I hadn't thought about that. With careful use of umask, chgrp, and chmod (in that order and with proper error handling), you could protect yourself, but just setting it to the right value in the first place seems simpler.
- mindslight 6y agoIf you're talking about command line programs (as opposed to fchown/fchmod on an open fd), there's still a race whereby an attacker in the shared group can make a link and get you to chgrp away one of your personal files.