I know what it means for a file to have suid permission. It means when other users have execute permission for it, they execute as the owner of the file. But what does it imply when a folder has suid permission? I did some testing and it seems nothing special for the folder. Could anyone help to plain a little? Thanks.

I'm using Oracle Linux 7.6.

root:[~]# cat /etc/*release*
Oracle Linux Server release 7.6
NAME="Oracle Linux Server"
PRETTY_NAME="Oracle Linux Server 7.6"

Red Hat Enterprise Linux Server release 7.6 (Maipo)
Oracle Linux Server release 7.6

Below is my testing on a freshly installed server.

root:[~]# pwd
root:[~]# ls -lad /root
dr-xr-x---. 9 root root 4096 Aug 16 22:07 /root
root:[~]# mkdir test
root:[~]# ls -lad test
drwxr-xr-x. 2 root root 4096 Aug 16 22:07 test
root:[~]# useradd a
root:[~]# passwd a
Changing password for user a.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
passwd: all authentication tokens updated successfully.
root:[~]# chmod u+s test
root:[~]# su - a
[a@localhost ~]$ cd /root/test
-bash: cd: /root/test: Permission denied
[a@localhost ~]$ cd /root
-bash: cd: /root: Permission denied
[a@localhost ~]$ logout
root:[~]# ls -lad /root
dr-xr-x---. 10 root root 4096 Aug 16 22:07 /root
root:[~]# chmod o+x /root
root:[~]# su - a
Last login: Fri Aug 16 22:08:54 CST 2019 on pts/0
[a@localhost ~]$ cd /root/test
[a@localhost test]$
[a@localhost test]$ pwd
[a@localhost test]$ ls -la .
total 8
drwsr-xr-x.  2 root root 4096 Aug 16 22:07 .
dr-xr-x--x. 10 root root 4096 Aug 16 22:07 ..
[a@localhost test]$ touch file1
touch: cannot touch ‘file1’: Permission denied
[a@localhost test]$ logout
root:[~]# chmod o+w test/
root:[~]# su - a
Last login: Fri Aug 16 22:09:31 CST 2019 on pts/0
[a@localhost ~]$
[a@localhost ~]$ cd /root/test
[a@localhost test]$ touch file1
[a@localhost test]$ ls -la
total 8
drwsr-xrwx.  2 root root 4096 Aug 16 22:11 .
dr-xr-x--x. 10 root root 4096 Aug 16 22:07 ..
-rw-rw-r--.  1 a    a       0 Aug 16 22:11 file1
[a@localhost test]$ mkdir folder1
[a@localhost test]$ ls -la
total 12
drwsr-xrwx.  3 root root 4096 Aug 16 22:11 .
dr-xr-x--x. 10 root root 4096 Aug 16 22:07 ..
-rw-rw-r--.  1 a    a       0 Aug 16 22:11 file1
drwxrwxr-x.  2 a    a    4096 Aug 16 22:11 folder1
[a@localhost test]$

As you can see, it seems the files and folders the user a created in /root/test didn't inherit the owner and group of it. The owner and group is a and not root. Are there any problems with my testing? I'm new in Linux.

  • Oh yes, thank you. Does this apply to all Linux distribution like Ubuntu? What is the distribution that @m242 mentioned in his answer? It seems that Linux does use suid for directories. Commented Aug 16, 2019 at 14:24
  • 2
    It applies to all Linux distributions, because this is how the Linux kernel is.
    – muru
    Commented Aug 16, 2019 at 14:25
  • There is a lot of history about these flags - worth reading around the whole subject if you want to lean more about all the different approaches for this. https://en.wikipedia.org/wiki/Chmod
    – MoopyGlue
    Commented Aug 16, 2019 at 14:34

2 Answers 2


According to the GNU manual, it means files (including subfolders) created in the directory will inherit its group and user:

On a few systems, a directory’s set-user-ID bit has a similar effect on the ownership of new subfiles and the set-user-ID bits of new subdirectories. These mechanisms let users share files more easily, by lessening the need to use chmod or chown to share new files.

  • Since this is Linux, the setuid not doesn't do anything on directories.
    – muru
    Commented Aug 16, 2019 at 14:17
  • Does anyone know any of these systems that support SUID on directories? Commented Aug 16, 2019 at 14:38
  • @Christopher that's my bad, sorry. I edited to include a quote from the manual and included the bit about setgid as well by mistake.
    – terdon
    Commented Aug 16, 2019 at 14:39
  • It might mean that for some systems, but it doesn't mean that for Linux, which the question mentioned. I'm not sure if there is a authoritative documentation about that for Linux specifically.
    – ilkkachu
    Commented Aug 16, 2019 at 15:53

That doesn't mean anything on your Oracle Linux or on any Linux system.

However it may have meaning on FreeBSD. Quoting from the chmod(2) manpage:

If mode ISUID (set UID) is set on a directory, and the MNT_SUIDDIR option was used in the mount of the file system, then the owner of any new files and subdirectories created within this directory are set to be the same as the owner of that directory. If this function is enabled, new directories will inherit the bit from their parents. Execute bits are removed from the file, and it will not be given to root. This behavior does not change the requirements for the user to be allowed to write the file, but only the eventual owner after it has been created. Group inheritance is not affected.

This feature is designed for use on fileservers serving PC users via ftp, SAMBA, or netatalk. It provides security holes for shell users and as such should not be used on shell machines, especially on home directories. This option requires the SUIDDIR option in the kernel to work. Only UFS file systems support this option. For more details of the suid- dir mount option, see mount(8).

This is not supported on other *BSD systems like NetBSD or OpenBSD.

Not the answer you're looking for? Browse other questions tagged .