how to list all server services running on my Linux computer

How can I find out the list of all services running on my computer that might give access to hackers to log in to my computer?

One day I looked at my /var/log/auth.log from my computer and I discovered there had been several ssh login attempts and that ssh server was installed in my computer. But I couldn't remember me installing ssh server on this computer. I must have installed some package that depends on ssh package. Made me wonder what other services is running in this computer that I don't know of.


Solution 1:

The services need not be running at the time you do your check in order to present a security risk. I'd recommend using a port scanning tool like Nessus or nmap (from an outside machine) to see what ports are open. Then you can look in /etc/services and /etc/xinetd.d to figure out which services are associated with the open ports, and decide whether they can be turned off or blocked.

Solution 2:

netstat -lp will give you a list of running servers, along with their pid.