SSH-Agent is a useful tool for automating the input of a passphrase in SSH Key Pair authentication. It is particularly helpful for users who have set up SSH Key Pair with a passphrase.
Start SSH-Agent:
Run SSH-Agent to start managing your SSH keys.
eval $(ssh-agent)
# Agent pid 1826
This will output the process ID of the SSH-Agent.
Add SSH Key with Passphrase:
Add your SSH key to the SSH-Agent.
ssh-add
# Follow the prompt to enter your passphrase
# Enter passphrase for /home/cent/.ssh/id_rsa:
# Identity added: /home/cent/.ssh/id_rsa (cent@dlp.emc.world)
After entering the passphrase, the identity will be added to the SSH-Agent.
Verify Added Key:
Check that your SSH key is correctly added to the SSH-Agent.
ssh-add -l
# 3072 SHA256:yYOKaIcT25Jd0ZaOOYLa+rgrU0c/M/rVmJx4q4MVZB0 cent@dlp.emc.world (RSA)
This command will list the keys managed by the SSH-Agent.
SSH Connection Test:
Try connecting to a remote host using SSH without entering the passphrase.
ssh remote_host
Example:
ssh node01.emc.world hostname
# node01.emc.world
The connection should be successful without prompting for the passphrase.
Stop SSH-Agent:
It's important to stop the SSH-Agent process when you're done to prevent it from running after you log out.
eval $(ssh-agent -k)
# Agent pid 1826 killed
This command will stop the SSH-Agent process.
Note: Replace remote_host, node01.emc.world, and other placeholders with actual server addresses or hostnames relevant to your setup. This document helps users set up and use SSH-Agent for a more efficient SSH experience without the need to repeatedly enter passphrases.