using chkconfig to turn off services in bulk
When Linux is installed by default , a lot of services are turned on. But there are many services are not needed, in order to system security and stability, can be combined with their own actual needs, shut down the use of services. the Chkconfig command is primarily used to start, stop, and query run-level information for system services,Chkconfig not immediately disable or activate a service, it simply changes the symbolic connection.
detailed information can be viewed through the man . Here are the operations for bulk shutdown of some services.
To view running services
[Email protected] ~]# chkconfig--list|grep "3:on"
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/7C/AF/wKioL1bWUlSSTrbBAAbBozG0GUg792.jpg "title=" 1.jpg " Width= "730" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:730px;height:360px; "alt=" Wkiol1bwulsstrbbaabbozg0gug792.jpg "/>
The following is a separate shutdown ip6tables service,off is not filled, the default is to turn off 2.3.4.5
[Email protected] ~]# chkconfig ip6tables off
[Email protected] ~]# chkconfig--list ip6tables
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/7C/AF/wKioL1bWUnGSXPouAAEQEeJX7rw049.jpg "title=" 2.jpg " Width= "730" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:730px;height:71px; "alt=" Wkiol1bwungsxpouaaeqeejx7rw049.jpg "/>
The following command takes the first column, which lists the name of the service
[[email protected] ~]#chkconfig--list|grep "3:on" |awk ' {print$1} '
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/7C/B0/wKiom1bWUhPS71dCAAHRB32k11I266.jpg "title=" 3.jpg " Width= "730" height= "420" border= "0" hspace= "0" vspace= "0" style= "width:730px;height:420px;" alt= " Wkiom1bwuhps71dcaahrb32k11i266.jpg "/>
With the above operation, we have already seen which of the currently open services. Now we are combining the needs of the server to shut down unnecessary services
Method One, turn off all services first, then only the desired service
1.1 Close all services, turn off all 3 on
[[email protected] ~]# for zdw in ' chkconfig--list|grep ' 3:on ' |awk ' {print '} ';d o chkconfig $zdw off;done
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/7C/AF/wKioL1bWUrnRFyMMAADHEJw2toM215.jpg "title=" 4.jpg " Width= "730" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:730px;height:45px; "alt=" Wkiol1bwurnrfymmaadhejw2tom215.jpg "/>
1.2 only start the following Crond|network|sshd|rsyslog four services
[[email protected] ~]# for zdw in Crond network sshd rsyslog;do chkconfig $zdw on;done
[Email protected]~]# chkconfig--list|grep "3:on"
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/7C/B0/wKiom1bWUm_xIasSAAH8RcNIMe0853.jpg "title=" 5.jpg " Width= "730" height= "106" border= "0" hspace= "0" vspace= "0" style= "width:730px;height:106px;" alt= "wkiom1bwum_ Xiassaah8rcnime0853.jpg "/>
method Two, open the service, exclude Crond|network|sshd|rsyslog Four services, all others off
2.1 lists the following four services that are open
[[Email protected]~]# chkconfig--list|grep ' 3:on ' |awk ' {print '} ' |grep-ve ' Crond|network|sshd|rsyslog '
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/7C/AF/wKioL1bWUz_C9cN9AAIkjmcX1M0183.jpg "title=" 6.jpg " Width= "730" height= "353" border= "0" hspace= "0" vspace= "0" style= "width:730px;height:353px;" alt= "wkiol1bwuz_ C9cn9aaikjmcx1m0183.jpg "/>
2.2 excluding Crond|network|sshd|rsyslog four services, all others closed
[[Email protected]~]# for zdw in ' chkconfig--list|grep ' 3:on ' |awk ' {print '} ' |grep-ve ' crond|network|sshd| Rsyslog "';d o chkconfig $zdwoff;d One
[Email protected]~]# chkconfig--list|grep "3:on"
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/7C/B0/wKiom1bWUuLgG660AAJp0gTh1BA260.jpg "title=" 7.jpg " Width= "730" height= "122" border= "0" hspace= "0" vspace= "0" style= "width:730px;height:122px;" alt= " Wkiom1bwuulgg660aajp0gth1ba260.jpg "/>
This article is from the "Zhao Dongwei Learning record" blog, so be sure to keep this source http://zhaodongwei.blog.51cto.com/4233742/1746624
Using Chkconfig to turn off services in bulk