Centos(5.8)开启telnet服务,当需要升级openssh的时候

本文详细介绍了如何在 CentOS 5.8 上安装和配置 telnet 服务,包括安装 telnet-server 软件包、启动服务、测试连接以及允许 root 用户通过 telnet 登录的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CentOS5.8上安装telnet服务

当你需要升级openssh的时候,为了避免中途升级失败,导致远程不上,先将telnet开启。

1.查看系统版本及是否安装telnet

    [root@centos32 comodo]# cat /etc/issue
    CentOS release 5.8 (Final)
    Kernel \r on an \m
    [root@centos32 comodo]# rpm -qa|grep telnet
    telnet-0.17-39.el5

其中CentOS系统默认已经安装了telnet,但是telnet-server软件包需要自行安装

2.安装telnet-server
    1.可以下载rpm包安装(下载地址:http://rpmfind.net/linux/rpm2html/search.php?query=telnet-server)
    2.可以#yum install telnet-server
安装完成后检查安装是否成功:

    [root@centos32 comodo]# rpm -qa|grep telnet
    telnet-0.17-39.el5
    telnet-server-0.17-39.el5

3.启动telnet服务
    方法1:图形桌面System->Administration->Services->"On Demand Services"菜单页选中telnet并保存
    方法2:图形桌面Applications->Accessories->Terminal中输入#/usr/sbin/ntsysv回车选中telnet并保存
    方法3:修改/etc/xinetd.d/telnet将disable = yes修改为no, 可以使用命令#sed -i 's/disable = yes/disable = no/' /etc/xinetd.d/telnet
    方法4:修改启动项#/sbin/chkconfig telnet on
    方法3和方法4需要重启telnet服务,运行命令#/etc/rc.d/init.d/xinetd restart

4.测试服务

    [root@centos32 comodo]# telnet localhost
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    CentOS release 5.8 (Final)
    Kernel 2.6.18-308.16.1.el5 on an i686
    login: comodo
    Password:
    Last login: Thu Dec 6 15:19:27 from debian32
    [comodo@centos32 ~]$ exit(此处可知telnet已经使用用户comodo成功登录)
    logout
    Connection closed by foreign host.
    [root@centos32 comodo]#


5.允许root登录telnet(默认情况下,telnet禁止root用户登录)
    方法1.修改/etc/pam.d/remote注释掉auth    required    pam_securetty.so

    [root@centos32 comodo]# vim /etc/pam.d/remote
    #%PAM-1.0
    #auth required pam_securetty.so

    方法2.先查看root登录使用的伪终端号,然后把这个伪终端加到/etc/securetty中
step 1:打开一个终端输入

    [root@centos32 comodo]# telnet localhost
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    CentOS release 5.8 (Final)
    Kernel 2.6.18-308.16.1.el5 on an i686
    login: root
    Password:
    Login incorrect
    login: Login timed out after 60 seconds
    Connection closed by foreign host.

step 2:打开一个终端输入

    [root@centos32 comodo]#tail /var/log/secure
    Dec 6 15:51:15 centos32 login: pam_securetty(remote:auth): access denied: tty 'pts/7' is not secure !
    Dec 6 15:51:18 centos32 login: FAILED LOGIN 1 FROM centos32 FOR root, Authentication failure

step 3:把pts/7加入到/etc/securetty后,telnet即可使用root账户登录

    [root@centos32 comodo]# vim /etc/securetty
    pts/7

当你需要升级openssh的时候,为了避免中途升级失败,导致远程不上,先将telnet开启。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值