LFCS · Question #469
Which of the following find command will print out a list of suid root files in /usr?
The correct answer is A. find /usr -uid 0 -perm +4000. To find SUID files owned by root in the /usr directory, the find command requires specifying the search path, the root user's UID, and the SUID permission bit.
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
(50 responses)- A92% (46)
- C2% (1)
- D4% (2)
- E2% (1)
Why each option
To find SUID files owned by root in the `/usr` directory, the `find` command requires specifying the search path, the root user's UID, and the SUID permission bit.
This command correctly specifies the search path (`/usr`), the owner's user ID (0 for root with `-uid 0`), and the SUID permission bit (`-perm +4000`), which finds files with the SUID bit set.
The `+mode +s` syntax is not a valid `find` predicate for specifying permissions; `find` uses `-perm`.
`-type suid`, `-username root`, and `-d /usr` are not valid `find` options or predicates.
`-ls *s*` is not a valid `find` option for matching SUID files, and `-u root` is not the correct syntax for specifying a user.
While `-perm +4000` is correct for the SUID bit, `-suid` is not a standard `find` predicate, and the owner still needs to be explicitly specified (e.g., `-user root` or `-uid 0`) to find *SUID root* files.
Concept tested: Finding SUID files with `find`
Source: https://man7.org/linux/man-pages/man1/find.1.html
Topics
Community Discussion
No community discussion yet for this question.