LX0-104 · 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. This question asks for the correct find command syntax to locate SUID root files within the /usr directory. The correct command utilizes the -uid 0 option for root and -perm +4000 for 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
(57 responses)- A79% (45)
- B4% (2)
- C7% (4)
- D2% (1)
- E9% (5)
Why each option
This question asks for the correct find command syntax to locate SUID root files within the /usr directory. The correct command utilizes the -uid 0 option for root and -perm +4000 for the SUID permission bit.
The find command with /usr specifies the starting directory. -uid 0 correctly identifies files owned by the root user (UID 0), and -perm +4000 correctly finds files with the SUID bit set, as 4000 represents the SUID permission.
The -user option requires a username or UID, not root +mode +s. +mode +s is not a valid find predicate for SUID, and the directory /usr should precede the predicates or be after them, but the syntax is incorrect.
-type suid is not a valid find predicate for SUID files; -username is also not a standard find predicate. -d /usr is not how you specify the starting directory.
-ls *s* is not a valid find predicate; -ls is an action to print file details, and *s* is a pattern that would be interpreted incorrectly. -u root is an invalid option; the correct one is -user root.
-suid is not a valid find predicate; the correct way to search for SUID files is using the -perm option with the appropriate permission bit.
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.