I have set up ssh-agent on my macOS laptop, and a 24x7 running server. Why do I need to kill ssh-agent on every logout?
Source of my knowledge of ssh-agent: https://kb.iu.edu/d/aeww
eval `ssh-agent` # Start ssh-agent
echo $SSH_AGENT_PID # 20552 (Check ssh-agent is running)
ssh-add # Add id_rsa key to ssh-agent
kill $SSH_AGENT_PID # Kill ssh-agent on logout
Why is this last step required?
Methods to kill ssh-agent
processes
The easiest way I've found to find all running shh-agent processes
ps ax | grep ssh-agent # outputs details of processes
OR
pgrep ssh-agent # outputs list of PIDs only
The easiest way I've found to kill all running ssh-agent processes
pkill ssh-agent