Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does the suid bit have any special meaning for device files in Linux ?

share|improve this question
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 ? – derobert Sep 13 '12 at 15:45
You don't execute a device file so it won't have any effect. – LawrenceC Nov 9 '15 at 13:31
up vote 3 down vote accepted

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 in fs/exec.c which is used when prepairing executable file to set EUID on exec,
  • pid_revalidate function in fs/proc/base.c which is used to populate procfs,
  • notify_change function in fs/attr.c which is used when changing file attributes,
  • is_sxid function in include/linux/fs.h which is only used by XFS and GFS specific code and notify_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.

share|improve this answer
Don't forget some of these bits serve a purpose for DIRECTories too. – mdpc Sep 13 '12 at 22:14
@mdpc Directories are also files. – Chris Down Sep 14 '12 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. – Krzysztof Adamski Sep 14 '12 at 6:00
Thank you for detailed explanation and answer – hostmaster Sep 14 '12 at 6:51
@KrzysztofAdamski I don't see any effect from changing the SUID bit on a directory. What effect would you expect it to have? – kasperd Nov 6 '15 at 9:06

Your Answer


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.