【问题标题】:how to configure Password less authentication With Git Client and git server?如何使用 Git 客户端和 git 服务器配置无密码身份验证?
【发布时间】:2021-07-31 18:35:53
【问题描述】:

当我执行时在 git bash 中运行 ssh-keygen 之后

$ scp id_rsa.pub kovair@192.168.12.232:.ssh/authorized_keys

我得到了

The authenticity of host '192.168.12.232 (192.168.12.232)' can't be established.

ECDSA key fingerprint is SHA256:v9aX9gU44tKMXefUA1V2bgPVzP1PoICupP+cpU3sNB4.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.12.232' (ECDSA) to the list of known hosts.

kovair@192.168.12.232's password:

id_rsa.pub                                                  100%  403     3.2KB/s   00:00

在此之后,当我尝试验证天气无密码身份验证是否成功或未使用时

$ ssh kovair@192.168.12.232 ls

我收到了

kovair@192.168.12.232's password:

我猜在这一步中它不应该要求输入密码。

我做错了什么有人可以帮忙吗?

【问题讨论】:

  • 使用-vvv 运行ssh 命令来检查调试输出。
  • 提示:下次使用ssh-copy-id而不是scp。

标签: git ssh ssh-keys


【解决方案1】:

执行$ scp id_rsa.pub kovair@192.168.12.232:.ssh/authorized_keys后使用该命令

“ ssh {用户名}@{host:port} “chmod 700 .ssh ; chmod 640 .ssh/authorized_keys””

并在成功执行后运行您要求输入密码的命令。

【讨论】:

    【解决方案2】:

    您需要检查与创建的~/.ssh/authorized_keys 文件关联的权限。
    如here 或here 所示,它应该是600 (rw-------),并且 scp 可能会创建权限太开放而无法运行 SSH 守护进程的文件。

    这就是为什么正如评论所说,an ssh-copy-id 更可取。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-30
      • 2011-11-04
      • 2023-02-16
      • 2012-08-28
      • 2023-03-19
      • 1970-01-01
      • 2013-06-18
      • 1970-01-01
      相关资源
      最近更新 更多