I use ssh-add
to add my SSH keys to the SSH agent. By default, it adds them indefinitely. There's a command-line option to specify a timeout, but is there a configuration file option which will specify the default timeout?
What I want is to be able to run ssh-add
without any command-line parameters and have it default to a given amount of time for a timeout (as if I had called ssh-add -t 1h
).
Best Answer
AFAIK, there is no configuration in
sshd_config
orssh_config
to specify the time out forssh-agent
. Fromopenssh
source code, filessh-agent.c
:And in
process_add_identity
function:lifetime
is a global variable and only change value when parsing argument:If you use Ubuntu, you can set default options for
ssh-agent
in/etc/X11/Xsession.d/90x11-common_ssh-agent
: