Find Command: Part IV
Posted by Ameya on November 5th, 2007 filed in Security, Tips & Trix, linuxTo search the entire system for SUID or SGID files, you can run the following command:
find / -path /proc -prune -o -type f -perm +6000 -ls
The -prune option in this example is used to skip the /proc filesystem.
World-Writable Files
World-writable files are a security risk since it allows anyone to modify them. Additionally, world-writable directories allow anyone to add or delete files.
To locate world-writable files and directories, you can use the following command:
find / -path /proc -prune -o -perm -2 ! -type l -ls
The “! -type l” parameter skips all symbolic links since symbolic links are always world-writable. However, this is not a problem as long as the target of the link is not world-writable, which is checked by the above find command.
To locate files not owned by any user or group, use the following command:
find / -path /proc -prune -o -nouser -o -nogroup
Thanks to Werner Puschitz for providing such a wonderful tips.
This work by Ameya Pandit is licensed under a Creative Commons Attribution 2.5 India License
Photo Album





Leave a Comment