大网数据广告活动
服务器运维问答

Changing the ssh passphrase on a private key has no effect

· 52CE 我爱测

I had a not protected by passphrase ssh key which I use to connect with a server. Now I want to add a passphrase to the key, so I've done: ssh-keygen -p and added a new passphrase: Enter file in which the key is (/home/user/.ssh/…

问题原文

原帖链接 · Manolo · CC BY-SA 3.0

I had a not protected by passphrase ssh key which I use to connect with a server. Now I want to add a passphrase to the key, so I've done:

ssh-keygen -p

and added a new passphrase:

Enter file in which the key is (/home/user/.ssh/id_rsa): 
Enter old passphrase: 
Key has comment '/home/user/.ssh/id_rsa'
Enter new passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved with the new passphrase.

Then, I try to connect again to the server:

ssh [email omitted] -v

but I'm still logged without entering the passphrase:

debug1: Authentications that can continue: publickey

debug1: Next authentication method: publickey

debug1: Offering RSA public key: /home/user/.ssh/id_rsa

debug1: Server accepts key: pkalg ssh-rsa blen 279

debug1: Authentication succeeded (publickey).

Authenticated to server.com ([xxx.xx.xxx.xx]:22).

Why I'm not asked for the passphrase?

Edit:

Seahorse was storing the keys for me, so this was the issue.

已采纳解答

原帖链接 · Jakuje · CC BY-SA 3.0

ssh-agent is storing encrypted key in memory so change to the physical key on disk does not affect its functionality.

If you want make sure the change is effective, remove the key from agent and add it once more as noted in comments (ssh-add -D to remove and ssh-add to add the key again from default location).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-05-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。