nerdexam
CompTIA

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.

Shells, Scripting and Data Management

Question

Which of the following find command will print out a list of suid root files in /usr?

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)
  • A
    79% (45)
  • B
    4% (2)
  • C
    7% (4)
  • D
    2% (1)
  • E
    9% (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.

Afind /usr -uid 0 -perm +4000Correct

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.

Bfind -user root +mode +s /usr

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.

Cfind -type suid -username root -d /usr

-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.

Dfind /usr -ls \*s\* -u root

-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.

Efind /usr -suid -perm +4000

-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

#find command#SUID#file permissions#root user

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice