Telnet安装和配置,脚本一键安装!

网友投稿 643 2023-03-20

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

Telnet安装和配置,脚本一键安装!

[cce]#!/bin/bash

[cce]#!/bin/bash

#install the telnet service#defaultly add a user to test:#default_user: test default_passwd: testset +Hconfig_file=/etc/xinetd.d/telnetread -t 10 -p "installing now ?(y|n):" ANcase $AN inn|N|no):;;*)echo "start installing.....";sleep 2yum install -y telnet-server[ $? -ne 0 ]&& (echo "install fail.....";exit 1)echo "install secussfully....";;esacecho "Start to config...";sleep 3sed -i '/disable/s/yes/no/' $config_fileif [ $? -eq 0 ];thensed -i '/disable/d' $config_filesed -i '/{/a\\tdisable=no' $config_fileread -t 20 -p "limit the accessing ip{y|n} ?" ANficase $AN inyes|y|Y)while :doread -p "import the ip or network{eg 10.1.1.1 or 10.1.1.0/24}:" IP_NETsed -i "/{/a\no_access=$IP_NET" $config_file[ $? -eq 0 ]&&echo "Successfully......"echo -e "\n"read -t 10 -p "Go on ??(y|n):" answercase $answer inyes|y|Y)continue;;*)break;;esacdone;;*)echo -e "\n";;esacread -t 20 -p "set the only ip or net to access?(y|n):" ANcase $AN inyes|y|Y)while :doread -p "import the ip or network{eg 10.1.1.1 or 10.1.1.0/24}:" IP_NETsed -i "/{/a\only_from=$IP_NET" $config_file[ $? -eq 0 ]&&echo "Successfully......"echo -e "\n"read -t 10 -p "Go on ??(y|n):" answercase $answer inyes|y|Y)continue;;*)break;;esacdone;;*)echo -e "\n";;esacread -t 20 -p "if you need to change the port of telnet service?(y|n):" ANcase $AN inY|y|yes)read -p "Import the port you want to change to:" PORTecho "wait,changing.....";sleep 2sed -i "/^telnet/s/[0-9][0-9]*/$PORT/" /etc/services([ $? -ne 0 ]&& echo "sorry the changing has failed!!! the port is still 22,you can change by yourself!!")|| \echo "Changing successfully !!! the port of telnet is $PORT now!! you had batter remember this!!!";;*)echo -e "\n";;esacecho "The firewall may stop the telnet service,stop them or import a rule to allow?"select var in "Stop_firewall" "Import_A_rule" ;dobreakdoneecho "now do as your choice :$var";sleep 3case $var in"Stop_firewall")WORD=`service iptables status|grep -o stopped`if [ -n $WORD ];thenecho "The firewall has been stopped...."elseservice iptables stop([ $? -ne 0 ]&&echo "Failed...!! please do that by yourself....")|| \(echo "Successfully......";sleep 1)fi;;*)service iptables restart >/dev/null 2>&1iptables -I INPUT 1 -p tcp --dport 22 -j ACCEPT([ $? -ne 0 ]&&echo "Failed...!! please do that by yourself....";sleep 1)|| \echo "Successfully......";;esacread -t 10 -p "If you want to let the root user to login?(y|n):" ANcase $AN iny|Y|yes)for((i=0;i<=3;i++))do echo "pts/$i">>/etc/securetty;done[ $? -eq 0 ]&&echo " Sucessfully.....";sleep 2;;*):;;esacchkconfig --add telnet > /dev/null 2>&1chkconfig --level 35 telnet on > /dev/null 2>&1echo "Creating the user:test and the password is :test"| grep test --color=yes ;sleep 2useradd testpasswd test>/dev/null 2>&1<

上一篇:成都智能运维供应商电话(成都网络运维公司)
下一篇:Linux集群原理与安装配置详细说明
相关文章

 发表评论

暂时没有评论,来抢沙发吧~