1 .\" $NetBSD: sticky.7,v 1.4 2004/01/30 16:14:37 wiz Exp $
3 .\" Copyright (c) 1980, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)sticky.8 8.1 (Berkeley) 6/5/93
37 .Nd Description of the `sticky' (S_ISVTX) bit functionality
39 A special file mode, called the
43 is used to indicate special treatment for directories.
47 .Pa /usr/include/sys/stat.h
49 For regular files, the use of mode
51 is reserved and can be set only by the super-user.
53 does not currently treat regular files that have the sticky bit set
54 specially, but this behavior might change in the future.
55 .Sh STICKY DIRECTORIES
59 directory in which the deletion of files is restricted.
60 A file in a sticky directory may only be removed or renamed
61 by a user if the user has write permission for the directory and
62 the user is the owner of the file, the owner of the directory,
64 This feature is usefully applied to directories such as
66 which must be publicly writable but should deny users the license
67 to arbitrarily delete or rename each others' files.
69 Any user may create a sticky directory.
72 for details about modifying file modes.
74 The sticky bit first appeared in V7, and this manual page appeared
76 Its initial use was to mark sharable executables
77 that were frequently used so that they would stay in swap after
79 Sharable executables were compiled in a special way so their text
80 and read-only data could be shared amongst processes.
84 were such executables.
85 This is where the term
87 comes from - the program would stick around in swap, and it would
88 not have to be fetched again from the file system.
89 Of course as long as there was a copy in the swap area, the file
90 was marked busy so it could not be overwritten.
91 On V7 this meant that the file could not be removed either, because
92 busy executables could not be removed, but this restriction was
93 lifted in BSD releases.
95 To replace such executables was a cumbersome process.
96 One had first to remove the sticky bit, then execute the binary so
97 that the copy from swap was flushed, overwrite the executable, and
98 finally reset the sticky bit.
100 Later, on SunOS 4, the sticky bit got an additional meaning for
101 files that had the bit set and were not executable: read and write
102 operations from and to those files would go directly to the disk
103 and bypass the buffer cache.
104 This was typically used on swap files for NFS clients on an NFS
105 server, so that swap I/O generated by the clients on the servers
106 would not evict useful data from the server's buffer cache.
112 will create a file with the sticky bit set.