一、检查是否安装telnet
[root@Solin Solin]# rpm -qa | grep telnet
[root@Solin Solin]#
二、安装telnet客户端、服务端(如果已安装telnet则跳过此步骤)
yum -y install telnet*
三、检查是否安装xinetd
[root@Solin Solin]# rpm -qa | grep xinetd
[root@Solin Solin]#
四、安装xinetd服务(如果已安装xinetd则跳过此步骤)
yum -y install xinetd
五、telnet服务安装之后,默认是不开启服务,修改文件/etc/xinetd.d/telnet来开启服务
注:第一次修改,此文件若不存在,可自己vim创建修改:修改 disable = yes 为 disable = no
[root@Solin xinetd.d]# pwd
/etc/xinetd.d
[root@Solin xinetd.d]# ls
chargen-dgram daytime-stream echo-dgram time-dgram
chargen-stream discard-dgram echo-stream time-stream
daytime-dgram discard-stream tcpmux-server
[root@Solin xinetd.d]# vim telnet
[root@Solin xinetd.d]# cat telnet
# default: yes
# description: The telnet server servestelnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server =/usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
[root@Solin xinetd.d]#
六、启动telnet和依赖的xinetd服务
[root@Solin xinetd.d]# systemctl restart xinetd.service
[root@Solin xinetd.d]# ps -ef | grep xinetd #查看xinetd是否启动
root 6100 1 0 10:20 ? 00:00:00 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
root 6159 3770 0 10:21 pts/1 00:00:00 grep --color=auto xinetd
[root@Solin xinetd.d]# ps -ef | grep telnet #查看telnet是否启动
root 6239 3770 0 10:22 pts/1 00:00:00 grep --color=auto telnet
[root@Solin xinetd.d]#
七、测试telnet
在windows下打开cmd命令行窗口,输入telnet 192.168.1.10 回车,然后输入用户名密码。
八、设置服务开机启动
将xinetd服务加入开机自启动:systemctl enable xinetd.service
将telnet服务加入开机自启动:systemctl enable telnet.socket