SK0-004 · Question #356
An email administrator is tasked to set up a Linux mail server. One of the requirements is to close all ports except SSH, HTTPS, SMTP, POP3, and IMAP4. Which of the following commands should be used…
The correct answer is A. lsof B. netstat. To audit which ports are currently open on a Linux server, administrators use utilities that query the kernel's socket and network state. Both lsof and netstat can list active listening ports and their associated processes.
Question
An email administrator is tasked to set up a Linux mail server. One of the requirements is to close all ports except SSH, HTTPS, SMTP, POP3, and IMAP4. Which of the following commands should be used to see which ports are currently open on the email server? (Choose two.)
Options
- Alsof
- Bnetstat
- Cipconfig
- Dtraceroute
- Eping
- Fdig
How the community answered
(32 responses)- A88% (28)
- D3% (1)
- E3% (1)
- F6% (2)
Why each option
To audit which ports are currently open on a Linux server, administrators use utilities that query the kernel's socket and network state. Both lsof and netstat can list active listening ports and their associated processes.
The lsof (list open files) command on Linux treats network sockets as file descriptors, so running 'lsof -i' displays all open network connections and listening ports along with the process that owns them.
The netstat command (or its modern replacement 'ss') queries the kernel's networking subsystem and outputs a table of all active TCP and UDP sockets, including those in a LISTEN state, making it ideal for auditing open ports.
ipconfig is a Windows command for displaying IP configuration; the Linux equivalent is ifconfig or ip addr, and neither shows listening ports.
traceroute maps the network path (hops) between two hosts and provides no information about which ports are open on the local server.
ping tests basic ICMP reachability to a host but does not reveal port or service information.
dig is a DNS lookup utility used to query name servers for record information and has no ability to list open ports on a local machine.
Concept tested: Linux commands to list open and listening ports
Source: https://man7.org/linux/man-pages/man8/netstat.8.html
Topics
Community Discussion
No community discussion yet for this question.