Linux服务器---配置telnet

简介:
配置telnet
      通过配置文件,我们可以设置telnet的连接时间、连接数、连接ip等,实现更加安全的连接

1、设置连接时间,参数“access_times”
      [root@localhost wj]#  gedit /etc/xinetd.d/telnet
       service telnet
      {
      flags = REUSE
      socket_type = stream        
      wait = no
      user = root
      server = /usr/sbin/in.telnetd
      log_on_failure += USERID
      disable = no
      access_times = 08:00-09:00 13:00-15:00           //规定允许连接的时间段8~9点,13~15点
      }


      [root@localhost wj]#  service xinetd restart         //重启服务
      停止 xinetd:                                              [确定]
      正在启动 xinetd:                                          [确定]

      [root@localhost wj]#  telnet 192.168.0.119           //尝试连接
      Trying 192.168.0.119...
      Connected to 192.168.0.119.
      Escape character is '^]'.
      Connection closed by foreign host.                  //连接失败

2、设置连接数,通过参数“instances”可以设置允许的连接数,超过之后就无法再连接了
      [root@localhost wj]#  gedit /etc/xinetd.d/telnet
       service telnet
      {
      flags = REUSE
      socket_type = stream        
      wait = no
      user = root
      server = /usr/sbin/in.telnetd
      log_on_failure += USERID
      disable = no
      instances      = 1                                   //这里设置只允许一个连接,第二个就无法连接了
      }


      [root@localhost wj]#  service xinetd restart         //重启服务
      停止 xinetd:                                              [确定]
      正在启动 xinetd:                                          [确定]

      [root@localhost wj]#  telnet 192.168.0.119          //第一个连接
      Connected to 192.168.0.119.
      login: david       
      Password:
      Last login: Thu Aug 16 09:10:22 from 192.168.0.119
      already login                                          //成功

      [root@localhost wj]#  telnet 192.168.0.119        //第二个连接
      Connected to 192.168.0.119.
      Connection closed by foreign host.                //失败

3、允许/禁止特定的ip或者网段登录,参数“only-from”“no_access” 
      [root@localhost wj]#  gedit /etc/xinetd.d/telnet  
       service telnet
      {
      flags = REUSE
      socket_type = stream        
      wait = no
      user = root
      server = /usr/sbin/in.telnetd
      log_on_failure += USERID
      disable = no
      only_from  = 192.168.0.113                     //只允许113连接
      # only_from  = 192.168.0.0/24                    //允许1~254连接
      # only_from  = 192.168.0.100-192.168.0.200    //允许100~200连接
      # only_from  = 192.168.0.                        //允许113和114连接
      # no_access  = 192.168.0.113                    //禁止113连接,其他写法同上
      }
 

4、允许root连接。只要将文件“/etc/securetty”删除,那么系统读不到这个文件,自然就会永续root登录
      [root@localhost wj]#  mv /etc/securetty /etc/securetty.bak     //重命名该文件
      [root@localhost wj]#  service xinetd restart                     //重启服务
      停止 xinetd:                                              [确定]
      正在启动 xinetd:                                          [确定]
      [root@localhost wj]#  telnet 192.168.0.119                        //连接
      Trying 192.168.0.119...
      Connected to 192.168.0.119.
      login: root                                                           //使用root用户连接
      Password:                                                              
      Last login: Thu Aug 16 07:51:45 from 192.168.0.119
      already login                                                         //连接成功
相关文章
|
14天前
|
消息中间件 安全 Unix
SSH配置多台服务器之间的免密登陆以及登陆别名
SSH配置多台服务器之间的免密登陆以及登陆别名
26 1
|
1天前
|
Linux
如何将一个linux服务器挂载到另外一个linux服务器上
如何将一个linux服务器挂载到另外一个linux服务器上
13 1
|
1天前
|
Oracle Java 关系型数据库
Linux环境安装配置JDK11
Linux环境安装配置JDK11
15 0
|
1天前
|
Ubuntu Linux
Linux(Ubuntu)系统临时IP以及静态IP配置(关闭、启动网卡等操作)
请注意,以上步骤是在临时基础上进行配置的。如果要永久保存静态IP地址,通常还需要修改 `/etc/network/interfaces`文件,以便在系统重启后保持配置。同时,确保备份相关配置文件以防止出现问题。
11 1
|
2天前
|
监控 Linux 网络安全
Linux服务器如何查询连接服务器的IP
【4月更文挑战第15天】Linux服务器如何查询连接服务器的IP
9 1
|
3天前
|
监控 安全 Linux
Linux系统之安装ServerBee服务器监控工具
【4月更文挑战第22天】Linux系统之安装ServerBee服务器监控工具
41 2
|
3天前
|
安全 Ubuntu Linux
Linux 网络操作命令Telnet
Linux 网络操作命令Telnet
16 0
Linux 网络操作命令Telnet
|
3天前
|
Ubuntu Linux 测试技术
Linux(32)Rockchip RK3568 Ubuntu22.04上部署 Docker: 详细配置与功能测试(下)
Linux(32)Rockchip RK3568 Ubuntu22.04上部署 Docker: 详细配置与功能测试
35 1
|
3天前
|
运维 网络协议 Linux
Linux(28) Linux双网卡配置为连接到Linux主机的PC提供外网访问
Linux(28) Linux双网卡配置为连接到Linux主机的PC提供外网访问
30 1
|
4天前
|
Ubuntu 网络协议 Linux
Linux(20) Ubuntu 20.04 网络接口自动切换路由配置
Linux(20) Ubuntu 20.04 网络接口自动切换路由配置
27 0