Linux系统管理 安全篇 之开放端口

查看系统中开放的端口,关闭不需要的端口和程序,如下例中操作流程:

(原文链接 http://ddbiz.com/?p=170)

 

1. 查看对外开启的端口:

 

[root@mail ~]# nmap 127.0.0.1 #注:此处应该换作公网ip

 

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2010-04-20 11:06 CST

Interesting ports on 127.0.0.1

Not shown: 1668 closed ports

PORT     STATE SERVICE

22/tcp   open  ssh

25/tcp   open  smtp

80/tcp   open  http

1010/tcp open  unknown

 

2. 对不明端口进行查访

[root@mail ~]# netstat -anlp | grep 1010

tcp        0      0 0.0.0.0:1010                0.0.0.0:*                   LISTEN      3796/rpc.statd

 

#

#[root@mail ~]# lsof -p 3796

#

#

[root@mail init.d]# which rpc.statd

/sbin/rpc.statd

 

[root@mail ~]# rpm -qf /sbin/rpc.statd

nfs-utils-1.0.9-40.el5

 

[root@mail init.d]# ll /etc/init.d/nfs*

-rwxr-xr-x 1 root root 4668 Jan 21  2009 /etc/init.d/nfs

-rwxr-xr-x 1 root root 3465 Jan 21  2009 /etc/init.d/nfslock

 

[root@mail init.d]# service nfs status

rpc.mountd is stopped

nfsd is stopped

rpc.rquotad is stopped

 

[root@mail ~]# /etc/init.d/nfslock status

rpc.statd (pid 3796) is running...

 

3. 关闭不相干的应用

[root@mail init.d]# service nfslock

Usage: /etc/init.d/nfslock {start|stop|status|restart|probe|condrestart}

 

[root@mail init.d]# service nfslock stop

Stopping NFS statd:                                        [  OK  ]

 

4. 关闭不相干的服务

[root@mail init.d]# chkconfig --level 345 nfslock off

 

 

5.  基本安装centos,这些服务一般使用不到:

chkconfig --level 2345 hplip off                  #涉及hpiod, hpssd, 与打印设备相关

chkconfig --level 2345 nfslock off               #涉及到 nfs 

chkconfig --level 2345 avahi-daemon off   #涉及到 zeroconf 协议的设备和服务

chkconfig --level 2345 cups off                  #涉及到打印

chkconfig --level 2345 portmap off            #涉及到 nfs

(原文链接 http://ddbiz.com/?p=170)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值