Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
200 views
in Technique[技术] by (71.8m points)

What should I do to private key after adding it to ssh-agent?

I created a key with ssh-keygen and added it to ssh-agent successfully.

All I know about ssh-agent is that it will encrypt my private key and enable ssh connection without using passphrase each time.

I am curious if I can delete the keys in ~/.ssh directory after adding them to ssh-agent because when I try to see the private key, I can see it just like before.

I guess I do not understand how ssh-agent is helping with security here because if anyone has access to my machine, they can easily see my private key.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The ssh-agent is an helper program that keeps track of user's identity keys (ie private keys) and their passphrases.
The agent can then use the keys to log into other servers without having the user type in a password or passphrase again.

So the ssh-agent actually needs the private key to operate correctly (that is, to cache the passphrase, and reuse said passphrase when the private key is used).

Do not delete your private keys!
As long as their are in your home folder, in a 600 .ssh subfolder, nobody but you can access them.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...