警告
本文最后更新于 2019-04-18,文中内容可能已过时。
今天在使用 ssh
连接服务器的时候出现一个错误,这里记录一下解决方法:
1
2
3
4
5
|
ssh-copy-id ${USER}@${HOST}
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 6 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Received disconnect from 192.168.1.199 port 22:2: Too many authentication failures
Disconnected from 192.168.1.199 port 22
|
修改 /etc/ssh/sshd_config
1
2
3
|
Last login: Thu Apr 18 15:26:32 2019 from 192.168.1.199
[root@localhost ~]# cd /etc/ssh/
[root@localhost ssh]# vim sshd_config
|
把允许试错的限制修改一下
1
2
|
# MaxAuthTries 6
MaxAuthTries 10
|
然后重启 ssh
1
|
systemctl restart sshd.service
|
重新连接
1
2
3
4
5
6
7
8
9
|
ssh-copy-id ${USER}@${HOST}
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 6 key(s) remain to be installed -- if you are prompted now it is to install the new keys
trader@192.168.1.199's password:
Number of key(s) added: 6
Now try logging into the machine, with: "ssh 'trader@192.168.1.199'"
and check to make sure that only the key(s) you wanted were added.
|