Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If I use setgid (chmod g+s) on a file (not a directory), it turns a dark yellow in the file list (of the particular Linux variant I'm using, anyway). But as far as I know, setgid doesn't actually do anything when applied to non-executable files.

Does it?

And, does anyone have a find command to find all non-directories and remove their setgid bit?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

As you suggest, setgid only applies to executable files and directories.

You can

 find -type f -perm /g+s chmod g-s '{}' \;

Just don't do this in /usr/bin!

share|improve this answer

Neither setuid or setgid have any impact on non-executable files.

Their meaning is that they are executed as though run by the owner of the file, not as the user (or group) running them. What would that mean for a non-executable file?

Regarding finding them, see http://www.faqs.org/faqs/computer-security/most-common-qs/section-15.html

share|improve this answer

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.