Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Setuid
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===When set on a directory=== Setting the <code>setgid</code> permission on a directory causes files and subdirectories created within to inherit its group ownership, rather than the primary group of the file-creating process. Created subdirectories also inherit the <code>setgid</code> bit. The policy is only applied during creation and, thus, only prospectively. Directories and files existing when the <code>setgid</code> bit is applied are unaffected, as are directories and files moved into the directory on which the bit is set. Thus is granted a capacity to work with files amongst a group of users without explicitly setting permissions, but limited by the security model expectation that existing files permissions do not implicitly change. The <code>setuid</code> permission set on a directory is ignored on most [[UNIX]] and [[Linux]] systems.<ref>{{cite web |title=27.5 Directories and the Set-User-ID and Set-Group-ID Bits |url=https://www.gnu.org/software/coreutils/manual/html_node/Directory-Setuid-and-Setgid.html#Directories-and-the-Set_002dUser_002dID-and-Set_002dGroup_002dID-Bits |website=GNU Coreutils 9.1 |publisher=Free Software Foundation |access-date=13 December 2022}}</ref>{{Citation needed|date=November 2017}} However [[FreeBSD]] can be configured to interpret <code>setuid</code> in a manner similar to <code>setgid</code>, in which case it forces all files and sub-directories created in a directory to be owned by that directory's owner - a simple form of inheritance.<ref>{{cite web |url=http://www.freebsd.org/cgi/man.cgi?query=chmod&apropos=0&sektion=0&manpath=FreeBSD+6.1-RELEASE&format=html |title=chmod -- change file modes|website=freebsd.org}}</ref> This is generally not needed on most systems derived from [[BSD]], since by default directories are treated as if their <code>setgid</code> bit is always set, regardless of the actual value. As is stated in <code>open(2)</code>, "When a new file is created it is given the group of the directory which contains it."<ref>{{cite web |title=open, openat -- open or create a file for reading, writing or executing|url=https://www.freebsd.org/cgi/man.cgi?query=open&sektion=2 |website=freebsd.org}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)