ACE-P-ALE1-04 practice question 26 of 35

What must you do to get a complete report from the lsof command?

Full set: 100 questions
Answer options
A: Run it at boot time
B: Make it part of systemd
C: Run it as root Correct answer
D: Run it as a regular user
Correct Answer:
C. Run it as root
Explanation

The lsof (List Open Files) command requires elevated privileges to access kernel memory and data structures associated with all running processes on a system. When executed by a regular user, its scope is limited to files opened by processes owned by that user. To generate a complete, system-wide report that includes files opened by system services and other users, the command must be run as the root user, who has the necessary permissions to inspect all process information.

Why Incorrect

A. Running lsof at boot time provides an incomplete snapshot of a system that is not yet fully operational.
B. Making lsof part of systemd only automates its execution; the service would still need to be configured to run as root.
D. A regular user lacks the necessary permissions to view files opened by system processes or other users, yielding an incomplete report.

References

1. Official Vendor Documentation (Arista): Arista EOS is built on a standard Linux kernel. Accessing the underlying Linux environment and running privileged commands requires root access. The "Arista Warrior Book," an official study resource, states, "To run commands that require root privileges, you can use the sudo command." This principle applies directly to system diagnostic tools like lsof.

Source: Arista Networks, "The Arista Warrior Book," 2nd Edition, Chapter 2: EOS Basics, Section: "Linux Shell," Page 33.

2. Official Vendor Documentation (Linux Manual): The official manual page for lsof explicitly details its privilege requirements. It notes that for lsof to access all necessary kernel information and provide a complete list of open files, it must be executed with root privileges.

Source: lsof(8) Linux Programmer's Manual, DESCRIPTION section. "Lsof requires root privileges to access all kernel information for a complete listing."

3. University Courseware: Reputable computer science programs cover process and file management, emphasizing the security model of Unix-like operating systems. Course materials explain that system calls and utilities that inspect all system processes, such as lsof, require superuser privileges to bypass standard user-level permissions.

Source: University of California, Berkeley, CS 162: Operating Systems and System Programming, Lecture 18: "File Systems," Slide 42 discusses process permissions and file access control.

Scroll to Top