The SUID special permission mode
$ which passwd
/usr/bin/passwd
$ ls -l /usr/bin/passwd
-r-s--x--x 1 root
root 17700 Jun 25 2004 /usr/bin/passwd
In the next example we perform the following
functions to show the effects of having the sticky bit set on
a directory:
1.
Starting out in the root directory (/) logged in as tclark,
we list child directory permissions using ls –l. Note that
the /shared directory and the /tmp directory have the
sticky bit set, indicated by the letter ‘t’ in the last position of
the permissions display.
2.
Change to the /shared directory and list the directory
contents, showing 3 files … one each owned by abe, tclark,
and root all with .dat suffixes.
3.
Attempt to delete all 3 files using rm *.dat and
getting errors for the files owned by abe and root,
but successfully deleting the file owned by tclark.
4.
Recreate the file owned by tclark that was just
deleted.
5.
Switch to the root user by using the su command
6.
As root, remove the sticky bit from the /shared
directory using the chmod o-t shared command.
7.
Switch back to the tclark user and reattempt step #3,
this time successfully deleting all three files (even the file owned
by root).