I ran netstat on a server and found ports 445, 1433, 3306, and 21, but I'm not sure what services they represent or why they're open. I assumed port 445 was Windows-only, although this machine appears to be running Linux. I was also given an IP address followed by a port number to test, but I couldn't get it to work. How can I identify which processes are listening on these ports and determine whether they're reachable from the internet? Also, I keep seeing people suggest `sudo rm -rf /`; I don't understand it, but I'm guessing it isn't something I should run. I've changed the server password to an easy-to-type value for now, but I'd appreciate advice on what these ports mean and how to secure the system.
3 Answers
The port numbers alone don’t prove what is running, since services can be configured to use different ports. Run `sudo ss -lntup` locally and compare the process names with the services installed on the machine. Then check your firewall and any cloud or router rules to see whether the ports are externally reachable. FTP, SMB, and database servers should not be exposed broadly unless there’s a specific reason, and they need strong unique passwords and current security updates.
Those ports usually correspond to common services: 445 is SMB, often provided by Samba on Linux; 1433 is typically Microsoft SQL Server; 3306 is commonly MySQL or MariaDB; and 21 is FTP. Linux can absolutely use port 445 because Samba implements SMB. Use `sudo ss -tulnp` or `sudo netstat -ntlp` to see which processes are actually listening, then check each service’s configuration and logs. If these ports are exposed to the internet, investigate them promptly—especially SMB and database services—and restrict access with a firewall or VPN where possible.
Do not run `sudo rm -rf /`. It attempts to recursively delete the filesystem as root and can destroy the operating system and data. Also replace the easy password immediately with a long, unique one, preferably using SSH keys for administration and disabling password login if practical. If you didn’t intentionally install these services, review recent package changes, user accounts, scheduled tasks, and logs, and consider isolating or rebuilding the server if you find signs of compromise.

That helps a lot. I’ll identify the listening processes first and then review the firewall rules instead of assuming the port numbers tell the whole story.