Does the suid bit have any special meaning for device files in Linux ?
1 Answer
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_suid
function, which is used on FS operations that should remove SUID/SGID bit,prepare_binprm
function infs/exec.c
which is used when prepairing executable file to set EUID onexec
,pid_revalidate
function infs/proc/base.c
which is used to populate procfs,notify_change
function infs/attr.c
which is used when changing file attributes,is_sxid
function ininclude/linux/fs.h
which is only used byXFS
andGFS
specific code andnotify_change
function,- 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.
-
-
-
@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+s
gives nothing on my machine (nor a few others I checked); does your machine have set id/sticky entries in /dev ?