nerdexam
Linux_Foundation

LFCS · Question #845

What does the following script do? #!/bin/bash find/ -perm +4000 | mail -s "Daily find output" root

The correct answer is A. Emails a report of all suid files to root. The script finds files with the SUID bit set across the entire filesystem and emails the list of these files to the 'root' user.

Submitted by lucia.co· Apr 18, 2026Essential Commands

Question

What does the following script do? #!/bin/bash find/ -perm +4000 | mail -s "Daily find output" root

Options

  • AEmails a report of all suid files to root.
  • BEmails a report of all important files to root.
  • CEmails a report of all writeable files to root.
  • DEmails a report of all guid files to root.
  • ECorrects permissions on files and emails the results to root.

How the community answered

(62 responses)
  • A
    87% (54)
  • B
    2% (1)
  • C
    3% (2)
  • D
    6% (4)
  • E
    2% (1)

Why each option

The script finds files with the SUID bit set across the entire filesystem and emails the list of these files to the 'root' user.

AEmails a report of all suid files to root.Correct

A is correct because `find / -perm +4000` specifically searches the entire filesystem (`/`) for files with the SUID (Set User ID) bit set (`+4000`). The output of this `find` command, which lists all such files, is then piped (`|`) to the `mail` command, sending it as an email with the subject "Daily find output" to the `root` user.

BEmails a report of all important files to root.

The command specifically looks for `+4000` permissions, not "important" files, which is a subjective term.

CEmails a report of all writeable files to root.

Writeable files would typically involve `w` permissions, not the SUID bit.

DEmails a report of all guid files to root.

GUID (Set Group ID) files are identified by the `+2000` permission bit, not `+4000`.

ECorrects permissions on files and emails the results to root.

The script only finds and reports files; it does not correct or modify any permissions.

Concept tested: `find` command (permissions, SUID) and basic scripting

Source: https://man7.org/linux/man-pages/man1/find.1.html

Topics

#find command#file permissions#SUID#email reports

Community Discussion

No community discussion yet for this question.

Full LFCS Practice