【问题标题】:How do you avoid typing the password of your ssh key each time, on Linux and Windows with OpenSSH? [closed]如何避免在 Linux 和 Windows 上使用 OpenSSH 每次都输入 ssh 密钥的密码? [关闭]
【发布时间】:2022-01-06 08:58:15
【问题描述】:

我使用受密码保护的 ssh 密钥 (RSA)。这意味着我需要在使用之前输入密码来破译密钥。

我注意到在某些计算机上,我不需要每次使用 ssh 密钥时都输入密码。

在我的 Windows 计算机以及一些 Linux 服务器上,我需要这样做。

我在 Windows 上使用 OpenSSH(不是 Putty),所以它与 Linux 的密钥相同。存放在/.shh目录中。

有一个受密码保护的密钥是很好的,以防有人窃取它。但是每次都输入密码很烦人。

有没有办法让我的电脑在 Windows 和 Linux 上记住它?

我在 shell 中使用它(默认的 Ubuntu 终端和 PowerShell,通常来自 VS Code)。

谢谢

我试过了,但没有成功:

(base) PS C:\code> ssh-add -k C:\Users\user\.ssh\id_rsa  
Enter passphrase for C:\Users\user\.ssh\id_rsa: 
Identity added: C:\Users\user\.ssh\id_rsa (C:\Users\user\.ssh\id_rsa)
(base) PS C:\code> git fetch
Enter passphrase for key '/c/Users/user/.ssh/id_rsa': 
????????????

【问题讨论】:

  • 请将您的问题移至Super User(在此处删除,在此处重新发布)。这是off-topic here
  • 来不及了,只能关闭了。

标签: linux powershell ssh ssh-keys openssh


【解决方案1】:

ssh-agent 是在初始解锁后保留密码的进程,因此您无需每次都输入密码

Linux Basic Tutorial on ssh-agent

Windows SSH documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-07
    • 2011-09-24
    • 2011-08-09
    • 2021-07-02
    • 1970-01-01
    • 2021-11-29
    • 2012-06-20
    相关资源
    最近更新 更多