PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys前面加上#屏蔽掉
PasswordAuthentication no修改为yes
最后重启sshd服务即可!
7. ssh连接错误问题
1) 在使用ssh或scp或rsync远程连接的时候,出现如下报错:
Address **** maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
解决方法:
修改本机ssh_config文件
[root@kvmserver ~]# vim /etc/ssh/ssh_config
GSSAPIAuthentication no
[root@kvmserver ~]#/etc/init.d/sshd restart
问题迎刃而解~~
2) 本机scp、rsync命令都已具备,但是在使用scp或rsync远程同步的时候报错:
bash: scp: command not found
bash: rsync: command not found
原因:是由于远程机器上没有安装scp或rsync造成的!安装这两个命令即可~
yum install openssh-clients
yum install rsync
3)远程ssh连接时错误“ The X11 forwarding request was rejected!”
解决方法:
将sshd_config中 设置 X11Forwarding yes
重启sshd服务。
8. ssh连接超时被踢出问题
当使用xshell,SecureCRT等客户端访问linux服务器,有时候会出现终端定期超时被踢出的情况。
下面介绍三种方法来防止超时被踢出的方法,后两种情况的设置方法以及通过设置shell变量来达到此目的的方法:
1、 配置服务器
# vim /etc/ssh/sshd_config
1)找到 ClientAliveInterval参数,如果没有就自己加一行
数值是秒,比如你设置为120 ,则是2分钟
ClientAliveInterval 120
2)ClientAliveCountMax
指如果发现客户端没有响应,则判断一次超时,这个参数设置允许超时的次数。如3 、5等自定义
修改两项参数后如下: