怎么关闭一个被打开的端口啊

zhangweimailbox
怎么关闭一个被打开的端口啊

服务器有一个端口被打开了可不知道是什么程序打开的,怎么把这个端口关闭掉啊

风之幻想
这个可难了.起码要知道是哪个端口号吧.或者,是哪个程序打开的。要不然,估计是没有办法关闭的.

zhangweimailbox
端口可以知道,关键是哪个程序怎么弄啊,有人说用lsof,可我的solaris10怎么没有这个指令啊

yuhuohu
sunfreeware.com
下一个lsof

briangao
The easy way is to download and install lsof as 风版 and yuhuohu have suggested. If you don't want to install lsof, try the following script:

[code]
#!/bin/sh

for PID in `ps -ef -o pid | tail +2`
do
        FOUNDPORT=`pfiles ${PID} 2>&1 | grep "sockname:" | grep "port:" | awk '{ print $NF }'`
        if [ X"${FOUNDPORT}" != "X" ]; then
                FOUNDPROC=`pfiles ${PID} 2>&1 | grep "^${PID}:"`
                echo "${FOUNDPROC}, ${FOUNDPORT}" | tr "/012" " "
                echo
        fi
done
[/code]