View Single Post
  #1   (View Single Post)  
Old 24th January 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default Comment out '/etc/inetd.conf' and disable 'inetd' daemon

Comment out /etc/inetd.conf and prevent inetd from starting:

Code:
# ---------------------------------------------------------
echo  Comment out all lines of inetd,conf

# -- real 
FILE=/etc/inetd.conf
BACKUP=/etc/${FILE}.orig

# -- testing
#FILE=$(basename ${FILE}) 
#BACKUP=$(basename ${BACKUP}) 

cp -p $FILE $BACKUP 
sed -e '/^[^#]/s/^/#/' $BACKUP > $FILE

The regular expression:
Code:
/	: start search
^	: at begin of line
[^#]	: followed by not a comment '#' sign
/	: end of search
Note that '^' means the the begin of line, or the null character
at the begin of line. Within a character class '[ ]' it negates the characters
from the character class. So '[#]' will match a '#', and '[^#]' matches
any character as long it is not a '#"

So on all lines which do not start with a '#' do the following "search and replace" :
Code:
s	: 'search and replace' or substitute
/	: delimiter or indicator for start of search pattern
^	: null string at begin of line
/	: end of search pattern, start of replacement pattern
#	: a literal '#' character
/	: end of replacement
A simple shell snippet to disable inetd on OpenBSD

Code:
# ----------------------------------------------------------
echo Disable inetd

FILE=/etc/rc.conf.local

cat <<END  >>${FILE}

inetd=NO
END
Note for FreeBSD users:
You will have to check "/etc/defaults/rc.conf" for the correct setting. Modify the FILE variable to point at /etc/rc.conf
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote