SSH Keys and Agent Cheat Sheet/Set agent key lifetime

Load a key that expires automatically from the agent.

Section: ssh-agent and ssh-add

Set agent key lifetime

bash
bash
ssh-add -t 1h ~/.ssh/id_ed25519
Explanation

Load a key that expires automatically from the agent.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing ssh-agent and ssh-add
Start ssh-agent in current shell
Start an agent and export its environment variables.
OpenIn sheetbashsame section
Add default key to agent
Load the default identity into ssh-agent.
OpenIn sheetbashsame section
List loaded keys
Show fingerprints of identities currently loaded in the agent.
OpenIn sheetbashsame section
List public keys in agent
Print public keys currently loaded in the agent.
OpenIn sheetbashsame section
Remove one key from agent
Delete a specific key from the agent.
OpenIn sheetbashsame section
Remove all keys from agent
Clear all identities from the agent.
OpenIn sheetbashsame section