Home 技术笔记 Linux 如何取消 SSH 私钥的密...

如何取消 SSH 私钥的密码

0

假设你当前的私钥文件为 `~/.ssh/id_rsa`:

  1. 打开终端,执行以下命令设置权限及运行取消密码命令:

    chmod 600 ~/.ssh/id_rsa
    chmod 700 ~/.ssh
    ssh-keygen -p -f ~/.ssh/id_rsa
  2. 然后按提示操作:

    Enter old passphrase:            # 输入旧密码
    Key has comment '...'
    Enter new passphrase (empty for no passphrase):    # 直接回车,表示不设置新密码
    Enter same passphrase again:                       # 再次回车确认
  3. 按提示操作:

  • 输入旧密码
  • 新密码留空,直接回车,即可取消密码保护

输出结果如下,说明你已经成功取消了私钥密码(即设置为空密码):

Enter new passphrase (empty for no passphrase):   ← 你留空了
Enter same passphrase again:                      ← 再次留空确认
Your identification has been saved with the new passphrase.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

退出移动版