Telnet服务安装及配置

安装Telnet服务:

[root@Server ~]# yum install telnet-server -y

Installing : 2:xinetd-2.3.14-40.el6.x86_64    

Installing : 1:telnet-server-0.17-48.el6.x86_64

/etc/xinetd.d/telnet    //子配置文件

/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

查看xinetd服务是否安装

[root@Server ~]# rpm -ql xinetd

/etc/rc.d/init.d/xinetd     //启动脚本

/etc/xinetd.conf            //主配置文件

/usr/sbin/xinetd            //二进制命令

-----------------------------------------------------------------------------------------------------

[root@Server ~]# cat /etc/xinetd.conf |grep -v ^#

defaults {    

  log_type    = SYSLOG daemon info //日志类型,支持

  rsyslog     log_on_failure  = HOST          //失败日志,记录客户端的ip地址   

  log_on_success  = PID HOST DURATION EXIT    //成功日志,记录客户端的pid和ip

  cps     = 50 10             //每秒50个链接,如果超过限制,则等待10s再链接   

  instances   = 50        //最大连接数    

  per_source  = 10        //每个ip地址最多连接数

  v6only      = no        //不使用ipv6

  groups      = yes    

  umask       = 002

}

includedir /etc/xinetd.d    //包含的目录

[root@Server ~]# cat /etc/xinetd.d/telnet

service telnet {

    flags   = REUSE    

    socket_type = stream       //socket类型tcp协议

    wait   = no    //不等待    

    user  = root  //以root身份去运行    

    server  = /usr/sbin/in.telnetd   

    log_on_failure  += USERID    

    disable  = yes   //关闭服务

}

修改配置文件

vim /etc/xinetd.d/telnet

只修改这一行

disabled = no

启动服务

[root@Server ~]# /etc/init.d/xinetd start

或者

[root@Server ~]# service xinetd start

[root@Server ~]# /etc/init.d/xinetd status

如果客户端telnet 连接不上查看端口是否被占用

[root@Server ~]# netstat -alntp|grep 23

默认是不允许连接root用户的

[root@client01 ~]# telnet 192.168.8.132   

Trying 192.168.8.132...    

Connected to 192.168.8.132.  

Escape character is '^]'.  CentOS release 6.7 (Final)  

Kernel 2.6.32-573.el6.x86_64 on an x86_64    

login: root    

Password:    

Login incorrect

只允许某个网段的人连接,如:192.168.0.0/24 可以 man 5 xinetd.conf

修改配置文件

vim /etc/xinetd.d/telnet

only_from = 192.168.0.254

可以以端口号来访问

[root@client01 ~]# telnet 192.168.8.132 23

======================================================================

windows下cmd终端访问Telnet 解决Telnet不是内部命令,

打开控制面板--->程序和功能----->打开或关闭Windows功能----->将Telnet客户端的勾上,即可

win+r------>cmd----->telnet 192.168.8.132 23 默认不允许使用root用户访问

输入用户名和密码即可访问

posted @ 2016-09-16 22:24  一干而尽  阅读(2789)  评论(0编辑  收藏  举报