Home > Enterprise >  Rename SSH Key Agent that was already added
Rename SSH Key Agent that was already added

Time:09-11

I added 2 ssh key using ssh-keygen command, one for personal and one for client. Running ssh-add -l will display all the agent added via ssh-add and this is what I get.

enter image description here

I wonder if we can rename the existing ssh key email so it is much clearer. As much as possible I do not want to delete the existing, just want to update its email.

I didn't know before that you can configure ssh key generation like this

ssh-keygen -t rsa -b 4096 -C "[email protected]" -f id_rsa
ssh-keygen -t rsa -b 4096 -C "[email protected]" -f id_rsa-client

Which could give me a list of ssh agent with different email when running ssh-add -l

4096 SHA256:XXXXXX [email protected] (RSA)
4096 SHA256:XXXXXX [email protected] (RSA)

CodePudding user response:

Those aren't actually emails, just "comments". You can update the keyfile with

ssh-keygen -c -C "[email protected]" -f .ssh\id_rsa

Then remove and re-add the identity with

ssh-add -D
ssh-add

Your key would still work with the sites and servers you've registered the public key to.

  • Related