nerdexam
CompTIA

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.

Shells, Scripting and Data Management

Question

Which of the following find commands will print out a list of files owned by root and with the SUID bit set 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

(42 responses)
  • A
    81% (34)
  • B
    2% (1)
  • C
    2% (1)
  • D
    5% (2)
  • E
    10% (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`.

Afind /usr -uid 0 -perm +4000Correct

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.

Bfind -user root +mode +s /usr

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

Cfind -type suid -username root -d /usr

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

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

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

Efind /usr -suid -perm +4000

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

#find command#file permissions#SUID bit#user ownership

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice