To find all world-writable directories that have the sticky bit set in Linux/UNIX, you can use the find
command.
The sticky bit is represented by the letter “t” in the permission bits for a directory. A directory that has the sticky bit set can only be deleted by its owner, even if it is world-writable.
To find all world-writable directories that have the sticky bit set, you can run the following command as root:
find / -type d -perm -2 -perm /1000
This command finds all directories (-type d
) that have the write permission set for all users (-perm -2
) and the sticky bit set (-perm /1000
) in the entire file system (/
).
The output will be a list of all directories that match the criteria, for example:
/var/tmp
/tmp
In this example, both /var/tmp
and /tmp
are world-writable directories that have the sticky bit set.