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.
netstat -lp will give you a list of running servers, along with their pid.
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.
socklist (if installed) - or a portscan from outside (with nmap)
netstat -lp is best way get info who got login to ur server or systemlink text
same good way to block all.
What distro?
You may be able to use a distro specific built in command to determine a bit more.
Exapmle on CentOS / Redhat: chkconfig --list | grep ":on"
will provide you with a listing of services that are up and running and their respective run level.
You could also nmap yourself to see what is listening, in addition to all the excellent netstat suggestions above...