您的位置:首页 > 运维架构 > Linux

在CentOS/RHEL/Scientific Linux 6 & 7 上安装Telnet

2017-09-05 15:45 696 查看
在CentOS/RHEL/Scientific Linux 6 & 7 上安装Telnet说明:在安装和使用Telnet之前,需要记住以下几点。在公网(WAN)中使用Telnet是非常不好的想法。它会以明文的格式传输登入数据。每个人都可以看到明文。如果你还是需要Telnet,强烈建议你只在局域网内部使用。你可以使用SSH作为替代方法。但是确保不要用root用户登录。Telnet定义:Telnet 是用于通过TCP/IP网络远程登录计算机的协议。一旦与远程计算机建立了连接,它就会成为一个虚拟终端且允许你与远程计算机通信。安装Telnet:yum安装telnet和telnet-server[root@rhel7 ~]# yum install -y telnet telnet-server现在telnet已经安装在你的服务器上了。编辑文件/etc/xinetd.d/telnet[root@ceshiji ~]# vim /etc/xinetd.d/telnet设置 disable = no保存并退出文件。说明:我们不必在Linux 7做这步,原因如下图:Yum 安装telnet-server区别:Linux6安装telnet-server时有xinetd依赖包被安装,而Linux7并没有xinetd依赖包被安装!Linux7开启telnet服务在Linux 6系统中:[root@ceshiji ~]# service xinetd start在Linux7系统中:[root@rhel7 ~]# systemctl start telnet.socket开机自启动telnet服务在Linux 6系统中:[root@ceshiji ~]# chkconfig telnet on[root@ceshiji ~]# chkconfig xinetd on在Linux7系统中:[root@rhel7 ~]# systemctl enable telnet.socket查看telnet服务运行状态在Linux 6系统中:[root@ceshiji ~]# service xinetd status 或 [root@ceshiji ~]# /etc/init.d/xinetd status在Linux7系统中:[root@rhel7 ~]# service telnet.socket status 或 [root@rhel7 ~]# systemctl status telnet.sockettelnet默认的端口是23,查看侦听端口在Linux 6系统中:在Linux 7系统中:iptables与firewall的配置:说明:(1)如果不使用iptables与firewall可以将它们关闭,关闭的命令如下:[root@ceshiji ~]# iptables -F[root@ceshiji ~]# /etc/init.d/iptables stop[root@rhel7 ~]# systemctl stop firewalld[root@rhel7 ~]# systemctl disable firewalld(2)Linux7中不再有iptables,使用firewalld;在Linux7中安装并使用iptables的方法如下:[root@rhel7 ~]# yum install -y iptables-services开启iptables服务:[root@rhel7 ~]# systemctl start iptables查看iptables服务运行状态:[root@rhel7 ~]# systemctl status iptables开机自启动iptables服务:[root@rhel7 ~]# systemctl enable iptables使用iptables:[root@rhel7 ~]# vim /etc/sysconfig/iptables加入如下行“-A INPUT -p tcp -m state --state NEW --dport 23 -j ACCEPT”说明:上面只是演示下linux7中iptables安装和使用,实际工作中在linux7中,我们使用的是firewall!(3)开启iptables和firewall,让telnet的默认端口23可以通过防火墙和路由器。在Linux 6系统中: [root@ceshiji ~]# vim /etc/sysconfig/iptables 加入如下行“-A INPUT -p tcp -m state --state NEW --dport 23 -j ACCEPT” 保存退出!重启iptables服务。[root@ceshiji ~]# service iptables restart在Linux 7系统中:[root@rhel7 ~]# firewall-cmd --permanent --add-port=23/tcp[root@rhel7 ~]# firewall-cmd --reload测试[root@ceshiji ~]# yum install -y telnet说明:客户端上安装telnet包[root@rhel7 ~]# telnet 192.169.5.121完成!

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  CentOS RHEL Scientific