关于port的关闭——Linux

时间:2023-03-09 14:47:50
关于port的关闭——Linux

本文出自:http://blog.****.net/svitter

引文出自:http://bbs.chinaunix.net/thread-775649-1-1.html

1.关闭服务 service 服务 stop

netstat -ntlp

kill -9 PID

2.使用两个方法

1.
ps aux|grep port

kill -9 PID

2.
iptables -I INPUT -p tcp --dport 端口号 -j DROP

3.查看服务

grep
8080 /etc/services

原帖由 wangyl1977 于 2006-6-18 19:21 发表

grep 8080 /etc/services



webcache        8080/tcp                        # WWW caching service

webcache        8080/udp                        # WWW caching service



[quote]原帖由 wumu888 于 2006-6-18 18:54 发表

在services文件中注解

[/quote]

这仅仅是一个 “service_name/protocol & port” 的对比表而已

若你把 apache 的 listen port改为 12345,那么 netstat -lp,会看到port 12345 在监听

若你在 /etc/services 里面加入� 12345 port的说明,前面凝视为 platinum,那么 netstat -lp 就会变为 platinum 服务了

若用 iptables 做针对 port 的 DROP 的话,iptables -vL 也会看到相同的效果

这是在 /etc/nsswitch.conf 里面定义的,service 的解析使用 files

这个功能隶属于 /lib/libnss_files.so.1 和 /lib/libnss_files.so.2



关于 /etc/services 有非常多人有误解,以为删了/添了一行数据,就能够关掉/开启某个服务,这是错误的概念,我这里说一下