Does the suid bit have any special meaning for device files in Linux ?
I believe it is not. This bit is only used on executable files. It's defined in Linux kernel headers as
S_ISUID. If you grep kernel sources for this constant, you will find that it is only used in:
should_remove_suidfunction, which is used on FS operations that should remove SUID/SGID bit,
fs/exec.cwhich is used when prepairing executable file to set EUID on
fs/proc/base.cwhich is used to populate procfs,
fs/attr.cwhich is used when changing file attributes,
include/linux/fs.hwhich is only used by
GFSspecific code and
- in filesystem specific code (of course)
So it seems to me that this bit is only used (from userspace perspective) when executing files. At least on Linux.
Don't forget some of these bits serve a purpose for DIRECTories too.– mdpcSep 13, 2012 at 22:14
@mdpc Directories are also files. Sep 14, 2012 at 0:34
@mdpc: SUID bit on directory has a meaning at least on ext2/3 filesystem. Some other filesystems may implement some mechanisms similar to SGID bit on directories. But that's filesystem dependent so it only involves filesystem operations. Sep 14, 2012 at 6:00
@KrzysztofAdamski I don't see any effect from changing the SUID bit on a directory. What effect would you expect it to have?– kasperdNov 6, 2015 at 9:06
find /dev -perm /ugo+sgives nothing on my machine (nor a few others I checked); does your machine have set id/sticky entries in /dev ?