Linux – SUID has no effect on directories with Linux

chmoddirectorylinuxsetuid

Why does the SUID bit have no effect when applied to directories in Linux? I clearly see that I can set it with 'chmod u+s'. But why does it not have "any" effect. What is the reason for implementing a way to SET it but not implementing any effect?

Best Answer

The main reason to have a way to set it is simple: simplicity. It's simpler to treat the setuid bit on directories uniformly with other bits, than it would be to make an exception and reject attempts to set it.

Another reason is that you can mount a filesystem under Linux, set the setuid bit on a directory, and then mount this filesystem under another operating system that does treat the setuid bit in a meaningful way.

As for why the setuid bit has no effect on directories on Linux, that's because no one has found a compelling meaning for it. It can't work in the same way as the setgid bit because Linux doesn't allow a user to give away a file to another user.

Related Question