LFCS · 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. The command find /usr -uid 0 -perm +4000 correctly identifies files in /usr that are owned by the root user and have the SUID bit set.
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
(63 responses)- A76% (48)
- B2% (1)
- C3% (2)
- D11% (7)
- E8% (5)
Why each option
The command `find /usr -uid 0 -perm +4000` correctly identifies files in `/usr` that are owned by the root user and have the SUID bit set.
The `find` command searches for files based on specified criteria. `-uid 0` specifically targets files owned by the user with UID 0, which is typically the `root` user. The `-perm +4000` option searches for files where at least the SUID (Set User ID) bit is set, as 4000 represents the SUID permission.
`-user root` is correct, but `+mode +s` is not a standard `find` predicate for SUID, and the order of arguments is incorrect.
`-type suid` is not a valid `find` predicate for the SUID bit, and `-username root` and `-d /usr` are not standard or correctly formatted.
`-ls *s*` is incorrect syntax for checking the SUID bit, and `-u root` is not a standard `find` predicate for user ownership.
While `-perm +4000` is correct for SUID, `-suid` is not a standard `find` predicate; the correct way to specify user ownership is with `-user` or `-uid`.
Concept tested: Linux `find` command with permissions and ownership
Source: https://man7.org/linux/man-pages/man1/find.1.html
Topics
Community Discussion
No community discussion yet for this question.