ssh使用的一些问题

问题一:配置ssh免密登录时出现错误

debug2: we sent a publickey packet, wait for reply

debug3: receive packet: type 51

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password

debug1: Trying private key: /home/g/.ssh/id_dsa

debug3: no such identity: /home/g/.ssh/id_dsa: No such file or directory

debug1: Trying private key: /home/g/.ssh/id_ecdsa

debug3: no such identity: /home/g/.ssh/id_ecdsa: No such file or directory

debug1: Trying private key: /home/g/.ssh/id_ed25519

debug3: no such identity: /home/g/.ssh/id_ed25519: No such file or directory

debug2: we did not send a packet, disable method

debug3: authmethod_lookup password

debug3: remaining preferred: ,password

debug3: authmethod_is_enabled password

debug1: Next authentication method: password

解决方式:修改vim /etc/ssh/sshd_config配置中,StrictModes no,然后重启ssh:service sshd restart,就可以免密登录了

如果StrictModes为yes必需保证存放公钥的文件夹的拥有与登陆用户名是相同的。

问题二:ssh的时候出现

当ssh [email protected]出现如下错误:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!    @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

Someone could be eavesdropping on you right now (man-in-the-middle attack)!

It is also possible that a host key has just been changed.

The fingerprint for the ECDSA key sent by the remote host is

SHA256:AmePGXvg0Y7uHo//Gpc2VnOFl4h2XLRmqHvSWCYNxh4.

Please contact your system administrator.

Add correct host key in /home/g/.ssh/known_hosts to get rid of this message.

Offending ECDSA key in /home/g/.ssh/known_hosts:16

  remove with:

  ssh-keygen -f "/home/g/.ssh/known_hosts" -R 10.4.8.15

ECDSA host key for 10.4.8.15 has changed and you have requested strict checking.

Host key verification failed.

则说明,对应机器的公钥改变了,验证错误。

解决方式,删除对应的公钥信息:shh-keygen -R 10.4.8.15

你可能感兴趣的:(ssh使用的一些问题)