To reduce the risks of linux Hosts, we should try to cancel or delete unnecessary services.
Let's take a look at which ports are currently on.
[Root @ localhost linsc] # nmap 127.0.0.1
Starting nmap 3.70 (http://www.insecure.org/nmap/) at CST
Interesting ports on localhost. localdomain (127.0.0.1 ):
(The 1652 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
21/tcp openftp
22/tcp openssh
25/tcp opensmtp
80/tcp openhttp
766/tcpopenunknown
3306/tcp openmysql
8009/tcp openajp13
8080/tcp openhttp-proxy
Nmap run completed -- 1 IP address (1 host up) scanned in 0.194 seconds
We can see that port 766 is open and an unknown service is running. What service is this? At this time, I do not know.
[Root @ localhost linsc] # netstat-lp
The following content is displayed,
Tcp00 *: 766 *: * LISTEN3128/rpc. statd
This indicates that rpc. statd is running.
Let's take a look at the other method of listening port for command execution in 766.
[Root @ localhost linsc] # lsof-I: 766
COMMANDPIDUSER FD TYPE DEVICE SIZE NODE NAME
Rpc. statd 3128rpcuser8uIPv4 6467 TCP *: 766 (LISTEN)
Check that the rpc. statd command is the document of the installation package.
[Root @ localhost linsc] # rpm-qf/sbin/rpc. statd
Nfs-utils-1.0.6-80.EL4
Check what starts with nfs
[Root @ localhost linsc] # ls/etc/init. d/nfs *
/Etc/init. d/nfs/etc/init. d/nfslock
View nfslock status
[Root @ localhost linsc] #/etc/init. d/nfslock status
Rpc. statd (pid 3128) is running...
[Root @ localhost linsc] # vi/etc/services
Find the nfs in it, add # comment out in front, restart,
[Root @ localhost linsc] # nmap 127.0.0.1
Starting nmap 3.70 (http://www.insecure.org/nmap/) at CST
Interesting ports on localhost. localdomain (127.0.0.1 ):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
21/tcp openftp
22/tcp openssh
25/tcp opensmtp
80/tcp openhttp
3306/tcp openmysql
8009/tcp openajp13
8080/tcp openhttp-proxy
Nmap run completed -- 1 IP address (1 host up) scanned in 0.194 seconds