Results 1 to 4 of 4
I picked up a script from a hardening procedure, but it doesn't say what it is. Before I go and do something stupid, is this a valid Bash script? And ...
- 06-29-2009 #1
[SOLVED] Valid Bash script?
I picked up a script from a hardening procedure, but it doesn't say what it is. Before I go and do something stupid, is this a valid Bash script? And is there any reason (i.e.: totally break the system) why these services should be disabled? (yes, I intend for the system not to ever print, so cups is included)
for SERVICE in \
chargen \
chargen-udp \
cups \
cups-lpd \
daytime \
daytime-udp \
echo-udp \
eklogin \
ekrb5-telnet \
finger \
gssftp \
klogin \
krb5-telnet \
kshell \
ktalk \
ntalk \
rexec \
rlogin \
rsh \
talk \
tcpmux-server \
telnet \
tftp \
time-dgram \
time-stream \
uucp;
do
if [ -e /etc/xinetd.d/$SERVICE ]; then
echo "Disabling SERVICE($SERVICE) - `ls -la /etc/xinetd.d/$SERVICE`."
chkconfig ${SERVICE} off
else
echo "OK. SERVICE doesn't exist on this system ($SERVICE)."
fi
done
Sorry for the lack of whitespace, the forum software (grr) keeps deleting it, leading tabs, leading spaces, whatever
- 06-29-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You can keep the whitespaces if you enclose your code inside a code block. IE:
Anyway, without running it, it looks ok to me.Code:for SERVICE in \ chargen \ chargen-udp \ cups \ cups-lpd \ daytime \ daytime-udp \ echo-udp \ eklogin \ ekrb5-telnet \ finger \ gssftp \ klogin \ krb5-telnet \ kshell \ ktalk \ ntalk \ rexec \ rlogin \ rsh \ talk \ tcpmux-server \ telnet \ tftp \ time-dgram \ time-stream \ uucp; do if [ -e /etc/xinetd.d/$SERVICE ]; then echo "Disabling SERVICE($SERVICE) - `ls -la /etc/xinetd.d/$SERVICE`." chkconfig ${SERVICE} off else echo "OK. SERVICE doesn't exist on this system ($SERVICE)." fi doneSometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-29-2009 #3Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
Just to second Rubberman, from a quick glance it looks good to me, it's simply disabling the list of services provided. The backslash is just a carriage return/escape to allow the list to be more readable.
- 06-29-2009 #4
Seems to have worked with no adverse effects, thanks for the help.


