一、安装telnet软件包(通常要两个)
1、 telnet-client (或 telnet),这个软件包提供的是 telnet 客户端程序;
2、 telnet-server ,这个软件包提供的是 telnet 服务器端程序;
安装之前先检测是否这些软件包已安装,方法如下:
[root@ld-pc root]#rpm –q telnet或[root@ld-pc root]#rpm –q telnet-client [root@ld-pc root]#rpm –q telnet-server
如果没有检测到软件包,需要进行安装,red hat linux 9默认已安装了telnet软件包,一般只要安装telnet-server软件包。
1、在red hat linux 9的安装盘中获取telnet-server-0.17-25.i386.rpm软件包。
2、安装软件包
[root@ld-pc root]# rpm -Uvh telnet-server-0.17-25.i386.rpm warning: telnet-server-0.17-25.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e Preparing... ########################################### [100%] 1:telnet-server ########################################### [100%]
现在系统已经有了telnet-server的包了
[root@ld-pc root]# rpm -qa|grep 'telnet' telnet-0.17-26.EL3.2 telnet-server-0.17-26
二、启动telnet服务
telnet集成在xinetd服务中
[root@ld-pc root]# /sbin/chkconfig --list microcode_ctl 0:off 1:off 2:on 3:on 4:on 5:on 6:off gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off . . krb5-telnet: off rsync: off eklogin: off gssftp: off klogin: off chargen-udp: off kshell: off auth: on chargen: off daytime-udp: off daytime: off echo-udp: off echo: off services: off time: off time-udp: off cups-lpd: off sgi_fam: on swat: off telnet: off
这里的telnet属于off状态,通过下面的方法可以启动telnet
cp /etc/xinetd.d/telnet /etc/xinetd.d/telnet.bk //备份telnet配置文件 vi /etc/xinetd.d./telnet //修改disable的值为no
重新启动xinetd服务
[root@ld-pc root]# /sbin/service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ]
再次运行/sbin/chkconfig --list的结果
[root@ld-pc root]# /sbin/chkconfig --list microcode_ctl 0:off 1:off 2:on 3:on 4:on 5:on 6:off gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off . . . krb5-telnet: off rsync: off eklogin: off gssftp: off klogin: off chargen-udp: off kshell: off auth: on chargen: off daytime-udp: off daytime: off echo-udp: off echo: off services: off time: off time-udp: off cups-lpd: off sgi_fam: on swat: off telnet: on
可见telnet已经启动。
3、测试
[root@ld-pc root]# telnet 192.168.1.253 Trying 192.168.1.253. Connected to 192.168.1.253 Escape character is '^]'. Red Hat Enterprise Linux AS release 3 (Taroon Update 5) Kernel 2.4.21-32.EL on an i686 login:
如果登录失败,检查服务器的防火墙是否允许telnet。
4、如果xinetd服务没有配置为开机启动,可以配置xinetd为开机启动服务。
chkconfig xinetd --level 345 on
一般情况下不允许root登录telnet,如果需要,可以先用其他用户登录, 然后在su - root就可以了。