原因一: linux中没有telnet文件
其实关于linux系统的telnet登陆问题会有很多,我这里不是最全的,只是说的一些比较偏的问题,而且针对的是系统曾经登陆过的。telnet
输入以下命令查看系统是否存在xinetd、telnet、telnet-server这3个包,如图:
[root@localhost ~]# rpm -qa|grep xinetd
[root@localhost ~]# rpm -qa|grep telnet
我们发现这些都有,如果没有需要下载相应的安装包,可以直接用yum软件。
我用yum安装之后还是没有发现telnet文件
这个不是问题,我们直接输入以下命令:
[root@localhost xinetd.d]# vi /etc/xinetd.d/telnet
然后我们复制以下内容到telnet文件里面。
#default:no
# description: The telnet server servestelnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server =/usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
效果如下:
原因二:总是提示Login incorrect
主要原因是telnet是明文传输,安全性不高。所有系统默认是不开启的。
第一种解决办法:需要将/etc/pam.d/remote的第一行注释掉
在auth required pam_securetty.so前面加一个#号,如下图:
第二种解决办法
[root@localhost ~]# tail -n 3 /var/log/secure
Jun 14 10:21:44 localhost login: pam_securetty(remote:auth): access denied: tty 'pts/1' is not secure !
Jun 14 10:21:46 localhost login: pam_succeed_if(remote:auth): requirement "uid >= 1000" not met by user "root"
Jun 14 10:21:48 localhost login: FAILED LOGIN 1 FROM localhost FOR root, Authentication failure
添加下列语句
[root@localhost ~]# echo 'pts/1' >> /etc/securetty