# man > SSH-AGENT(1)

> **TLDR:** Spawn an SSH Agent process.
>
- Start an SSH Agent for the current shell:
  `eval $(ssh-agent)`
- Kill the currently running agent:
  `ssh-agent -k`

*Source: tldr-pages*

---

[_SSH-AGENT_(1)](https://www.chedong.com/phpMan.php/man/SSH-AGENT/1/markdown)                           General Commands Manual                          [_SSH-AGENT_(1)](https://www.chedong.com/phpMan.php/man/SSH-AGENT/1/markdown)

## NAME
       ssh-agent — OpenSSH authentication agent

## SYNOPSIS
       **ssh-agent   **[**-c   **|   **-s**]   [**-Dd**]   [**-a   _**bind_address_]  [**-E  _**fingerprint_hash_]  [**-O  _**option_]
                 [**-P _**allowed_providers_] [**-t _**life_]
       **ssh-agent  **[**-a  _**bind_address_]  [**-E  _**fingerprint_hash_]  [**-O  _**option_]  [**-P   _**allowed_providers_]
                 [**-t _**life_] _command_ [_arg_ _..._]
       **ssh-agent **[**-c **| **-s**] **-k**

## DESCRIPTION
       **ssh-agent  **is a program to hold private keys used for public key authentication.  Through use
       of environment variables the agent can be located and automatically used  for  authentication
       when logging in to other machines using [_ssh_(1)](https://www.chedong.com/phpMan.php/man/ssh/1/markdown).

       The options are as follows:

### -a _
               Bind   the   agent   to   the   Unix-domain  socket  _bind_address_.   The  default  is
               _$TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>_.

### -c      
               csh style of shell.

### -D      

### -d      
               debug information to standard error.

### -E _
               Specifies the hash algorithm used when displaying key  fingerprints.   Valid  options
               are: “md5” and “sha256”.  The default is “sha256”.

### -k      

### -O _
               Specify  an  option  when  starting  **ssh-agent**.  Currently two options are supported:
               **allow-remote-pkcs11 **and **no-restrict-websafe**.

               The **allow-remote-pkcs11 **option allows  clients  of  a  forwarded  **ssh-agent  **to  load
               PKCS#11  or  FIDO provider libraries.  By default only local clients may perform this
               operation.  Note that signalling that an **ssh-agent **client is remote is  performed  by
               [_ssh_(1)](https://www.chedong.com/phpMan.php/man/ssh/1/markdown),  and  use of other tools to forward access to the agent socket may circumvent
               this restriction.

               The **no-restrict-websafe **option instructs **ssh-agent **to permit  signatures  using  FIDO
               keys that might be web authentication requests.  By default, **ssh-agent **refuses signa‐
               ture  requests  for  FIDO  keys  where the key application string does not start with
               “ssh:” and when the data to be signed does not appear to be a [_ssh_(1)](https://www.chedong.com/phpMan.php/man/ssh/1/markdown) user authentica‐
               tion request or a [_ssh-keygen_(1)](https://www.chedong.com/phpMan.php/man/ssh-keygen/1/markdown) signature.  The default behaviour prevents  forwarded
               access  to  a FIDO key from also implicitly forwarding the ability to authenticate to
               websites.

### -P _
               Specify a pattern-list of acceptable paths for PKCS#11 provider and FIDO  authentica‐
               tor  middleware  shared  libraries  that  may  be  used  with the **-S **or **-s **options to
               [_ssh-add_(1)](https://www.chedong.com/phpMan.php/man/ssh-add/1/markdown).  Libraries that do not match the pattern list will be refused.  See  PAT‐
               TERNS in [_ssh_config_(5)](https://www.chedong.com/phpMan.php/man/sshconfig/5/markdown) for a description of pattern-list syntax.  The default list is
               “usr/lib*/*,/usr/local/lib*/*”.

### -s      
               like it's a csh style of shell.

### -t _
               Set  a  default value for the maximum lifetime of identities added to the agent.  The
               lifetime may be specified in seconds or in a time format specified in [_sshd_config_(5)](https://www.chedong.com/phpMan.php/man/sshdconfig/5/markdown).
               A lifetime specified for an identity with [_ssh-add_(1)](https://www.chedong.com/phpMan.php/man/ssh-add/1/markdown) overrides this  value.   Without
               this option the default maximum lifetime is forever.

       _command_ [_arg_ _..._]
               If  a  command (and optional arguments) is given, this is executed as a subprocess of
               the agent.  The agent exits automatically when the command given on the command  line
               terminates.

       There  are  two main ways to get an agent set up.  The first is at the start of an X session,
       where all other windows or programs are started as children of the  **ssh-agent  **program.   The
       agent  starts  a  command  under  which  its  environment variables are exported, for example
       **ssh-agent xterm &**.  When the command terminates, so does the agent.

       The second method is used for a login session.  When **ssh-agent  **is  started,  it  prints  the
       shell  commands  required to set its environment variables, which in turn can be evaluated in
       the calling shell, for example **eval `ssh-agent -s`**.

       In both cases, [_ssh_(1)](https://www.chedong.com/phpMan.php/man/ssh/1/markdown) looks at these environment variables and uses them to establish a  con‐
       nection to the agent.

       The  agent  initially  does not have any private keys.  Keys are added using [_ssh-add_(1)](https://www.chedong.com/phpMan.php/man/ssh-add/1/markdown) or by
       [_ssh_(1)](https://www.chedong.com/phpMan.php/man/ssh/1/markdown) when **AddKeysToAgent **is set in [_ssh_config_(5)](https://www.chedong.com/phpMan.php/man/sshconfig/5/markdown).  Multiple identities  may  be  stored  in
       **ssh-agent **concurrently and [_ssh_(1)](https://www.chedong.com/phpMan.php/man/ssh/1/markdown) will automatically use them if present.  [_ssh-add_(1)](https://www.chedong.com/phpMan.php/man/ssh-add/1/markdown) is also
       used to remove keys from **ssh-agent **and to query the keys that are held in one.

       Connections  to  **ssh-agent  **may be forwarded from further remote hosts using the **-A **option to
       [_ssh_(1)](https://www.chedong.com/phpMan.php/man/ssh/1/markdown) (but see the caveats documented therein), avoiding the need for authentication data to
       be stored on other machines.  Authentication passphrases and private keys never go  over  the
       network:  the connection to the agent is forwarded over SSH remote connections and the result
       is returned to the requester, allowing the user access to their identities  anywhere  in  the
       network in a secure fashion.

## ENVIRONMENT
       SSH_AGENT_PID  When  **ssh-agent  **starts, it stores the name of the agent's process ID (PID) in
                      this variable.

       SSH_AUTH_SOCK  When **ssh-agent **starts, it creates a Unix-domain socket and stores its pathname
                      in this variable.  It is accessible only to the current user,  but  is  easily
                      abused by root or another instance of the same user.

       In Debian, **ssh-agent **is installed with the set-group-id bit set, to prevent [_ptrace_(2)](https://www.chedong.com/phpMan.php/man/ptrace/2/markdown) attacks
       retrieving  private key material.  This has the side-effect of causing the run-time linker to
       remove certain environment variables which might have security implications for  set-id  pro‐
       grams,  including  LD_PRELOAD,  LD_LIBRARY_PATH, and TMPDIR.  If you need to set any of these
       environment variables, you will need to do so in the program executed by ssh-agent.

## FILES
       _$TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>_
               Unix-domain sockets used to contain  the  connection  to  the  authentication  agent.
               These sockets should only be readable by the owner.  The sockets should get automati‐
               cally removed when the agent exits.

## SEE ALSO
       [_ssh_(1)](https://www.chedong.com/phpMan.php/man/ssh/1/markdown), [_ssh-add_(1)](https://www.chedong.com/phpMan.php/man/ssh-add/1/markdown), [_ssh-keygen_(1)](https://www.chedong.com/phpMan.php/man/ssh-keygen/1/markdown), [_ssh_config_(5)](https://www.chedong.com/phpMan.php/man/sshconfig/5/markdown), [_sshd_(8)](https://www.chedong.com/phpMan.php/man/sshd/8/markdown)

## AUTHORS
       OpenSSH  is  a  derivative of the original and free ssh 1.2.12 release by Tatu Ylonen.  Aaron
       Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt  and  Dug  Song  removed  many
       bugs, re-added newer features and created OpenSSH.  Markus Friedl contributed the support for
       SSH protocol versions 1.5 and 2.0.

Debian                                     August 10, 2023                              [_SSH-AGENT_(1)](https://www.chedong.com/phpMan.php/man/SSH-AGENT/1/markdown)
