You can run sudo netstat -tlp
will show you all open sockets, and what program is using these. We can combine this with grep to show which web server we have running:
sudo netstat -tlp | grep https
tcp6 0 0 [::]:https [::]:* LISTEN 5541/apache2
We pass three parameters to netstat:
- -t asks for TCP sockets only, ignoring UDP.
- -l asks for listening sockets only, ignoring outgoing connections from e.g. your browser
- -p asks for program having the socket open.
In this case, apache2 is running, listening to https (on IPv6 on my box, as it is has native IPv6. If it had IPv4 in addition it would be listening to 0.0.0.0:https in addition).
In this case a sudo systemctl disable apache2
would disable Apache, and close the port. Note that this depends on what's actually listening. It may not even be a service.
That said, 902 and 443 reminds me of VMWare Workstation. Do you by any chance have that installed?
IPP is probably cups, and if you don't have any printers you can safely disable it. If you have printers, you need cups, but you can limit it to listen to only loopback interface or firewall it using ufw :)
sudo lsof -i -n -P +c 0 | grep ':443\|:631\|:902'
to find which services use these ports. Source. – pa4080 Oct 20 '17 at 17:04