2

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?

Adam Ernst
  • 177
  • 1
  • 6

2 Answers2

3

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!

crb
  • 7,928
  • 37
  • 53
1

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

Mikeage
  • 2,731
  • 6
  • 26
  • 37