SSH Agent Cheatsheet
SSH Agent (ssh-agent
) is a really useful tool for managing your SSH keys, so that you can quickly log into systems that use private SSH keys.
This is especially useful in the world of CI/CD when one needs to access private repositories through SSH keys when tokens can't be used.
Unfortunately, all the options are "shorthand", and there are no longhand equivalents. E.g. -D
to delete, instead of --delete
.
Related Posts
Table of Contents
Key Management
Add Key
ssh-add my-private-key
Remove Key
ssh-add -d my-private-key
List Keys
If you want a short list of the key length, hash, and name, then use:
ssh-add -l
3072 SHA256:XXXXXXXXXXXXXXXXXXXX8Havf+G/ydzf7pXihNyxEf4 programster@stu-bitfenix (RSA)
2048 SHA256:XXXXXXXXXXXXXXXXXXXXCierjcubIBVI7Z1cy8skMNY programster@stuart-r7-1700 (RSA)
If you want the full public keys to be output, then use:
ssh-add -L
References
Last updated: 23rd August 2022
First published: 29th July 2021
First published: 29th July 2021