LFCS · Question #263
Which of the following find commands will print out a list of suid root files in /usr?
The correct answer is A. find /usr -uid 0 -perm +4000. The find command can locate files with specific permissions and ownership, such as SUID files owned by root.
Question
Options
- Afind /usr -uid 0 -perm +4000
- Bfind -user root +mode +s /usr
- Cfind -type suid -username root -d /usr
- Dfind /usr -ls *s* -u root
- Efind /usr -suid -perm +4000
How the community answered
(47 responses)- A81% (38)
- B2% (1)
- C11% (5)
- D2% (1)
- E4% (2)
Why each option
The `find` command can locate files with specific permissions and ownership, such as SUID files owned by root.
The `find` command with `/usr` specifies the starting directory. `-uid 0` correctly identifies files owned by the root user (UID 0). The `-perm +4000` test correctly finds files where the SUID bit (octal 4000) is set, as `+` means 'at least one of the bits in the mode is set'.
`+mode +s` are not valid `find` primaries for permission checks; the correct syntax for SUID permissions involves `-perm`.
`-type suid` is not a valid argument for the `-type` primary, and `-username` is not a standard `find` primary.
The `*s*` is a pattern for file names, not a permission test, and `-u root` is not the correct syntax for specifying user ownership.
`-suid` is not a standard `find` primary for locating SUID files; the correct way is to use the `-perm` primary.
Concept tested: find command for SUID files
Source: https://man7.org/linux/man-pages/man1/find.1.html
Topics
Community Discussion
No community discussion yet for this question.