找回密码
 注册
首页 ≡≡网络技术≡≡ 服务器 Win2003服务器安全设置,禁用不必要的服务 ...

Win2003服务器安全设置,禁用不必要的服务

灰儿 2008-9-23 15:48:12
  对于经常重装系统的朋友来说,出于优化系统、减少内存占用亦或增强系统安全性能,往往都会修改很多系统服务的启动类型。将大量无用或者危险的服务关闭,参照许多服务优化的文章来看,大多需要禁用并停止20-30个服务将是一项比较烦琐的工作,我也是深受其害。然而从Windows XP开始,其自带的DOS工具中加入了一个sc.exe(Service Control)的文件,刚好可以对服务的启动类型以及服务的启动或者关闭等进行进行操作,再利用DOS的批处理优势,就可以把上面提到的种种操作进行大幅简化。

  sc.exe常用功能列表:
  1.更改服务的启动状态(这是比较有用的一个功能)
  2.删除服务(除非对自己电脑的软、硬件所需的服务比较清楚,否则不建议删除任何系统服务,特别是基础服务)
  3.停止或启动服务(功能上类似于net stop/start,但速度更快且能停止的服务更多)
  具体的命令格式如下:
  修改服务启动类型的命令行格式为(特别注意start=后面有一个空格)
  sc config 服务名称 start= demand(设置服务为手动启动)
  sc config 服务名称 start= disabled(设置服务为禁用)
  停止/启动服务的命令行格式为
  sc stop/start 服务名称
  注意:平时常接触的都是服务的显示名称,而以上所指是服务名称,都可以在控制面板->管理工具->服务里面,双击对应的服务来查询。
  先举例说明一下具体的设置方法:
  如设置远程注册表服务为手动其格式为
  sc config RemoteRegistry start= demand
  设为禁用的格式为:
  sc config RemoteRegistry start= disabled
  停止服务则格式为:
  sc stop RemoteRegistry
  首先把自己所需设置的服务名称查到之后,按照上面的格式做成批处理文件,重装系统之后只要运行批处理文件即可。
  以下是windows2003的服务设置,禁用了一些不必要的服务:

sc config AeLookupSvc start= AUTO
sc config Alerter start= DISABLED
sc config ALG start= DISABLED
sc config AppMgmt start= DEMAND
sc config aspnet_state start= DEMAND
sc config AudioSrv start= DISABLED
sc config BITS start= DEMAND
sc config Browser start= DEMAND
sc config CiSvc start= DISABLED
sc config ClipSrv start= DISABLED
sc config clr_optimization_v2.0.50727_32 start= DEMAND
sc config COMSysApp start= DEMAND
sc config CryptSvc start= AUTO
sc config DcomLaunch start= AUTO
sc config Dfs start= DEMAND
sc config Dhcp start= AUTO
sc config dmadmin start= DEMAND
sc config dmserver start= AUTO
sc config Dnscache start= AUTO
sc config ERSvc start= DISABLED
sc config Eventlog start= AUTO
sc config EventSystem start= AUTO
sc config helpsvc start= DISABLED
sc config HidServ start= AUTO
sc config HTTPFilter start= DEMAND
sc config IISADMIN start= AUTO
sc config ImapiService start= DISABLED
sc config IsmServ start= DISABLED
sc config kdc start= DISABLED
sc config lanmanworkstation start= DISABLED
sc config LicenseService start= DISABLED
sc config LmHosts start= DISABLED
sc config Messenger start= DISABLED
sc config mnmsrvc start= DISABLED
sc config MSDTC start= AUTO
sc config MSIServer start= DEMAND
sc config MSSEARCH start= AUTO
sc config MSSQLSERVER start= AUTO
sc config MSSQLServerADHelper start= DEMAND
sc config NetDDE start= DISABLED
sc config NetDDEdsdm start= DISABLED
sc config Netlogon start= DEMAND
sc config Netman start= DEMAND
sc config Nla start= DEMAND
sc config NtFrs start= DEMAND
sc config NtLmSsp start= DEMAND
sc config NtmsSvc start= DEMAND
sc config PlugPlay start= AUTO
sc config PolicyAgent start= AUTO
sc config ProtectedStorage start= AUTO
sc config RasAuto start= DEMAND
sc config RasMan start= DEMAND
sc config RDSessMgr start= DEMAND
sc config RemoteAccess start= DISABLED
sc config RemoteRegistry start= DISABLED
sc config RpcLocator start= DEMAND
sc config RpcSs start= AUTO
sc config RSoPProv start= DEMAND
sc config sacsvr start= DEMAND
sc config SamSs start= AUTO
sc config SCardSvr start= DEMAND
sc config Schedule start= AUTO
sc config seclogon start= AUTO
sc config SENS start= AUTO
sc config SharedAccess start= DISABLED
sc config ShellHWDetection start= AUTO
sc config SMTPSVC start= AUTO
sc config Spooler start= DISABLED
sc config SQLSERVERAGENT start= AUTO
sc config stisvc start= DISABLED
sc config swprv start= DEMAND
sc config SysmonLog start= AUTO
sc config TapiSrv start= DEMAND
sc config TermService start= AUTO
sc config Themes start= DISABLED
sc config TlntSvr start= DISABLED
sc config TrkSvr start= DISABLED
sc config TrkWks start= AUTO
sc config Tssdis start= DISABLED
sc config UMWdf start= DEMAND
sc config UPS start= DEMAND
sc config vds start= DEMAND
sc config VSS start= DEMAND
sc config W32Time start= AUTO
sc config W3SVC start= AUTO
sc config WebClient start= DISABLED
sc config WinHttpAutoProxySvc start= DEMAND
sc config winmgmt start= AUTO
sc config WmdmPmSN start= DEMAND
sc config Wmi start= DEMAND
sc config WmiApSrv start= DEMAND
sc config wuauserv start= DISABLED
sc config WZCSVC start= DISABLED
sc config xmlprov start= DEMAND

  如果需要立即关闭服务也可把以下代码跟在上面的代码之后
  sc stop W32Time
  sc stop ShellHWDetection
  sc stop TrkWks
  sc stop helpsvc
  sc stop dmserver
  sc stop PolicyAgent
  sc stop Spooler
  sc stop RemoteRegistry
  sc stop seclogon
  sc stop Schedule
  sc stop WZCSVC
  sc stop ERSvc
  sc stop Themes
  sc stop FastUserSwitchingCompatibility
  sc stop ProtectedStorage
  sc stop SSDPSRV
  sc stop WebClient

  最后把修改好之后的代码存为services.cmd,在以后进行服务设置时,直接运行事先保存好的批处理文件就可以做到事半功倍了。
您需要登录后才可以回帖 登录 | 注册
学习中心
站长自定义文字内容,利用碎片时间,随时随地获取优质内容。
Q设计语言 了解更多
Q Design 提供商家设计所需的指导与资源,帮商家快速完成产品设计、降低生产成本。
学习中心
站长自定义文字内容,利用碎片时间,随时随地获取优质内容。
Q设计语言 了解更多
Q Design 提供商家设计所需的指导与资源,帮商家快速完成产品设计、降低生产成本。