ssh登录失败处理步骤

时间:2021-08-07 11:48:29

  如果登录失败而又找不到显示的原因,优先使用ssh -vT name@ip -p port 进行调试,查看所使用的key文件、ip、端口是否正确。
然后再检查下面步骤:
1.检查在对应用户名下是否有identity_file文件,也就是key文件,在/home/xxx/.ssh下,有时候用另一个帐户操作。如使用了su后使用的就是root用户的。
2./home/xxx/.ssh权限是否对,比如出现Failed to add the host to the list of known hosts,就是权限不对。
  或者ssh-add出现Permissions 0777 for '.ssh/xxx' are too open.执行chmod 600 .ssh/xxx即可
3.如果ssh没有使用.ssh下的key去认证,需要执行 ssh-add /home/xxx/.ssh/xxx 添加密钥,或者是不是.ssh下的文件太多,需要写ssh配置
4.运行ssh-add出现Could not open a connection to your authentication agent.需要先运行ssh-agent。运行ssh-agent bash