linux系统出于安全考虑,默认情况下采用的是SSH服务,而不是telnet服务,可是有些时候会使用telnet来管理主机,这里介绍一下在Linux系统下如何安装和设置telnet服务
1.yum进行安装
[root@localhost ~]# yum install telnet-server
依赖
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
telnet-server x86_64 1:0.17-59.el7 base 40 k
Transaction Summary
================================================================================
Install 1 Package
安装成功
Is this ok [y/d/N]: y
Downloading packages:
telnet-server-0.17-59.el7.x86_64.rpm | 40 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:telnet-server-0.17-59.el7.x86_64 1/1
Verifying : 1:telnet-server-0.17-59.el7.x86_64 1/1
Installed:
telnet-server.x86_64 1:0.17-59.el7
Complete!
2.rpm -ql查看telent-server安装的位置
[root@localhost sysconfig]# rpm -ql telnet-server-0.17-59.el7.x86_64
[root@localhost ~]# rpm -ql telnet-server-0.17-59.el7.x86_64
/usr/lib/systemd/system/telnet.socket
/usr/lib/systemd/system/telnet@.service
/usr/sbin/in.telnetd
/usr/share/man/man5/issue.net.5.gz
/usr/share/man/man8/in.telnetd.8.gz
/usr/share/man/man8/telnetd.8.gz
3.安装xinetd
[root@localhost xinetd.d]# yum install xinetd
依赖
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
xinetd x86_64 2:2.3.15-12.el7 base 128 k
Transaction Summary
================================================================================
Install 1 Package
安装成功
Is this ok [y/d/N]: y
Downloading packages:
xinetd-2.3.15-12.el7.x86_64.rpm | 128 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:xinetd-2.3.15-12.el7.x86_64 1/1
Verifying : 2:xinetd-2.3.15-12.el7.x86_64 1/1
Installed:
xinetd.x86_64 2:2.3.15-12.el7
Complete!
4.rpm -ql查看xinetd安装的位置
[root@localhost xinetd.d]# rpm -ql xinetd.x86_64 2:2.3.15-12.el7
5.启动xinetd
[root@localhost xinetd.d]# service xinetd start
6.启动telent
[root@localhost xinetd.d]# systemctl start telnet.socket
7.netstat查看端口占用情况
[root@localhost xinetd.d]# netstat -ntlp
8.window验证
==========================网上的做法感觉更正确====================================
先检查CentOS7.0是否已经安装以下两个安装包:telnet-server、xinetd。命令如下:
rpm -qa telnet-server
rpm -qa xinetd
如果没有安装,则先安装。安装命令:
[root@master ~]# yum list |grep telnet
telnet-server.x86_64 1:0.17-59.el7 @base
telnet.x86_64 1:0.17-59.el7 base
[root@master ~]# yum install telnet-server.x86_64
[root@master ~]# yum install telnet.x86_64
[root@master ~]# yum list |grep xinetd
xinetd.x86_64 2:2.3.15-12.el7 @base
[root@master ~]# yum install xinetd.x86_64
安装完成后,将xinetd服务加入开机自启动:
systemctl enable xinetd.service
将telnet服务加入开机自启动:
systemctl enable telnet.socket
最后,启动以上两个服务即可:
systemctl start telnet.socket
systemctl start xinetd(或service xinetd start)
注意:systemctl用来代替service命令的