一、安装telnet
1、检测xinetd是否安装
telnet服务由xinetd守护,安装前先看看xinetd是否安装了.
[root@localhost ~]# rpm -qa xinetd
若未安装输入yum install xinetd
2、安装telnet服务端
[root@localhost ~]#yum install telnet-server
3、安装telnet客户端
[root@localhost ~]#yum install telnet
二、配置telnet
设置开机启动 [root@locahost ~]#chkconfig telnet on
修改配置文件 vi /etc/xinetd.d/telnet 将”disable= yes”改成” disable=no”
如果没有该文件则创建该文件,内容为:
# 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
}
为了安全需要,可以在该文件中配置连接本机的各种限制,如IP和开放时间
三、激活服务
重新启动守护进程: [root@locahost ~]#service xinetd restart
四、开放端口
查看23端口是否开启: [root@localhost ~]#netstat -tnl |grep 23
如果没有返回内容,可能是防火墙没有开放23端口,
[root@localhost ~]# firewall-cmd —query-port=23/tcp
no
显示23端口没有开启使用下面命令开启23端口(如果提示找不到这个命令使用yum install firewalld安装)
[root@localhost ~]# firewall-cmd —zone=public —add-port23/tcp —permanent
success
重新加载
[root@localhost ~]# firewall-cmd —complete-reload
success
再次查询
[root@localhost ~]# firewall-cmd —query-port=23/tcp
yes
再次执行[root@localhost ~]#netstat -tnl |grep 23
如果还没有返回内容可以尝试一下重启…..
五、测试
telnet localhost
vi /etc/pam.d/remote
注释第一行