January 19, 201115 yr Didn't see anyone had posted this. If you install sshd and thus can use ssh/sftp/scp to log in, you might want to turn off the telnet and ftp protocols. This should be able to do the trick. (Can always get in via the console) #!/bin/sh # # This turns off telnet and ftp, as scp/ssh/sftp should now be installed. # Telnet and FTP are _clear_ services, and as such, should not be used. # ##################################################################################### DATE=`date +%m%d%y` ##Format is MMDDYY TIME=`date +%H%M%S` ##Format is HHMMSS (24 hr) #backup original inetd.conf cp -rp /etc/inetd.conf /etc/inetd.conf.$DATE.$TIME cat /etc/inetd.conf|while read LINE do if [[ $LINE == ftp* ]] || [[ $LINE == telnet* ]]; then MODIFIER=`echo "$LINE"|awk '{print $1}'` echo "$LINE" cat /etc/inetd.conf|sed -i "s/^$MODIFIER/\#\#\#$MODIFIER/" /etc/inetd.conf fi done #Find inetd and tell it to re-read its configuration file. PTK=`ps -ef |grep inet|grep -v grep|awk '{print $2}'` kill -HUP $PTK
June 13, 201412 yr I understood how to copy the file but I was not clear what I need to add to the file to kill Telnet and FTP. Could please let me know what I need to do the edit the file? Thanks
June 14, 201412 yr Author I'm not positive what you mean. You take this script and put it into a file, make it executable (chmod 755 <scriptname>), and call it from the "go" file. Example: /boot/custom/execute_customization.sh Your /etc/inetd.conf file has these lines in it (not next to each other) ftp stream tcp nowait root /usr/sbin/tcpd vsftpd telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd That script there. If executed puts the # symbol into inetd which "comments out" the lines of code in there that "turn on telnet." (I actually put 3 of them there so we can tell it is this script that did it). The last part of it, find's the Process ID of inetd, and sends a kill -HUP to it.. which is a "restart and reread your configuration" request. So it re-reads the configuration file, sees that we want telnet/ftp is turned off, and stops listening to those requests. I can send further instructions if the above has not helped. -Kanth
Archived
This topic is now archived and is closed to further replies.