nerdexam
CompTIA

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.

Server administration

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)
  • A
    88% (28)
  • D
    3% (1)
  • E
    3% (1)
  • F
    6% (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.

AlsofCorrect

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.

BnetstatCorrect

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.

Cipconfig

ipconfig is a Windows command for displaying IP configuration; the Linux equivalent is ifconfig or ip addr, and neither shows listening ports.

Dtraceroute

traceroute maps the network path (hops) between two hosts and provides no information about which ports are open on the local server.

Eping

ping tests basic ICMP reachability to a host but does not reveal port or service information.

Fdig

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

#open ports#netstat#lsof#Linux network commands

Community Discussion

No community discussion yet for this question.

Full SK0-004 Practice