Juin 152011
pas trop besoin d’explication pour ce script, a prendre tel quel quasiment:
Download : disable_inetd_svcs.sh
#!/usr/bin/ksh
echo " --> Configuration des services inetd"
# Liste des services à désactiver.
DISABLES="bootps finger uucp gssd ncpm-pm registrar
rpc.rexd rpc.rstatd rpc.rusersd rpc.rwalld rpc.rquotad rpc.sprayd
ncpm-hip ftp telnet shell exec ntalk swat
klogin klogind discard chargen kshell klogin
recserv tftp daytime printer time echo"
awk -v TODEL="$DISABLES" '
BEGIN { split(TODEL ,del) ; }
{
for ( n = 1 ; n in del ; n++) {
if (del[n] == "") {
next ;
} else if ($1 == del[n]) {
printf("#%s\n",$0) ;
next ;
}
}
if ($1 ~ /^rpc$/) {
for ( n = 1 ; n in del ; n++) {
if (del[n] == "") {
next ;
} else if ($9 == del[n]) {
printf("#%s\n",$0) ;
next ;
}
}
}
print $0 ;
}' template.txt >| template.new.txt
PS: si c’est pour utiliser tout de suite, oubliez pas de recharger la config avec inetd -c