LX0-104 · Question #84
Which of the following find commands will print out a list of files owned by root and with the SUID bit set in /usr?
The correct answer is A. find /usr -uid 0 -perm +4000. To find files owned by root with the SUID bit set in /usr, the find command requires specifying the search path /usr, filtering by user ID 0 (root), and then filtering by permissions including the SUID bit using +4000.
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
(42 responses)- A81% (34)
- B2% (1)
- C2% (1)
- D5% (2)
- E10% (4)
Why each option
To find files owned by root with the SUID bit set in `/usr`, the `find` command requires specifying the search path `/usr`, filtering by user ID 0 (root), and then filtering by permissions including the SUID bit using `+4000`.
The `find` command is correctly structured with `/usr` as the path. `-uid 0` correctly identifies files owned by the root user, and `-perm +4000` matches files that have the SUID (Set User ID) bit set.
`-user root` is valid, but `+mode +s` is not a standard `find` predicate for SUID; `-perm +4000` is the correct way, and the path should be specified correctly.
`-type suid` and `-username root` are not valid `find` predicates; `-type f` or `d` etc. and `-user root` are correct, but `suid` as a type is incorrect. `-d /usr` is also an incorrect way to specify the path.
`-ls *s*` and `-u root` are not valid predicates for `find`; `-ls` performs a long listing, `*s*` is a shell glob, and `-u` is not for user.
`-suid` is not a standard `find` predicate; while `-perm +4000` correctly identifies the SUID bit, the first part is invalid.
Concept tested: Find command for permissions and ownership
Source: https://man7.org/linux/man-pages/man1/find.1.html
Topics
Community Discussion
No community discussion yet for this question.