SSH Agent

Create a systemd user-level config directory:

   mdkir -p .config/systemd/user/

Create the service unit file:


Description=SSH key agent

ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK


Enable the unit.

   systemctl --user enable --now ssh-agent

Add this to .bashrc so that the shell can find the socket:

   export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"

Then, add a key to the agent:

  ssh-add ~/.ssh/your-key.pem

From now until logout, keys will be stored in the agent.

Sensitive keys can be removed after use with ssh-add -D