CompTIA SecurityX (CAS-005)Security EngineeringEasy
A security engineer is tasked with implementing server hardening best practices across a fleet of Linux servers. As part of this process, the engineer needs to disable unnecessary services and close unused ports to minimize the attack surface. Which command-line utility is BEST suited for identifying currently open ports and the services listening on them?
- Anetstat
- Broute
- Cping
- Difconfig
Show answer & explanationAnswer & explanation
Correct answer: A. netstat
The `netstat` command-line utility is specifically designed to display network connections, routing tables, interface statistics, and, crucially, a list of open ports and the services/processes using them.
Why the other options are wrong
- B. The `route` command is used to view or manipulate the IP routing table.
- C. The `ping` utility is used to test the reachability of a host on an Internet Protocol (IP) network.
- D. The `ifconfig` utility is used to configure or view network interface parameters, not open ports.
netstat
A command-line utility that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics.
- Shows open ports and listening services
- Displays active network connections
- Useful for troubleshooting and hardening
Memory trick: Netstat Shows Network Stats, Services, and Open Ports.