{
    "mode": "man",
    "parameter": "ssh-agent",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/ssh-agent/1/json",
    "generated": "2026-09-20T03:18:38Z",
    "synopsis": "ssh-agent   [-c   |   -s]   [-Dd]   [-a   bindaddress]  [-E  fingerprinthash]  [-O  option]\n[-P allowedproviders] [-t life]\nssh-agent  [-a  bindaddress]  [-E  fingerprinthash]  [-O  option]  [-P   allowedproviders]\n[-t life] command [arg ...]\nssh-agent [-c | -s] -k",
    "sections": {
        "NAME": {
            "content": "ssh-agent — OpenSSH authentication agent\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ssh-agent   [-c   |   -s]   [-Dd]   [-a   bindaddress]  [-E  fingerprinthash]  [-O  option]\n[-P allowedproviders] [-t life]\nssh-agent  [-a  bindaddress]  [-E  fingerprinthash]  [-O  option]  [-P   allowedproviders]\n[-t life] command [arg ...]\nssh-agent [-c | -s] -k\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "ssh-agent  is a program to hold private keys used for public key authentication.  Through use\nof environment variables the agent can be located and automatically used  for  authentication\nwhen logging in to other machines using ssh(1).\n\nThe options are as follows:\n",
            "subsections": [
                {
                    "name": "-a _",
                    "content": "Bind   the   agent   to   the   Unix-domain  socket  bindaddress.   The  default  is\n$TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>.\n",
                    "flag": "-a"
                },
                {
                    "name": "-c",
                    "content": "csh style of shell.\n",
                    "flag": "-c"
                },
                {
                    "name": "-D",
                    "content": "",
                    "flag": "-D"
                },
                {
                    "name": "-d",
                    "content": "debug information to standard error.\n",
                    "flag": "-d"
                },
                {
                    "name": "-E _",
                    "content": "Specifies the hash algorithm used when displaying key  fingerprints.   Valid  options\nare: “md5” and “sha256”.  The default is “sha256”.\n",
                    "flag": "-E"
                },
                {
                    "name": "-k",
                    "content": "",
                    "flag": "-k"
                },
                {
                    "name": "-O _",
                    "content": "Specify  an  option  when  starting  ssh-agent.  Currently two options are supported:\nallow-remote-pkcs11 and no-restrict-websafe.\n\nThe allow-remote-pkcs11 option allows  clients  of  a  forwarded  ssh-agent  to  load\nPKCS#11  or  FIDO provider libraries.  By default only local clients may perform this\noperation.  Note that signalling that an ssh-agent client is remote is  performed  by\nssh(1),  and  use of other tools to forward access to the agent socket may circumvent\nthis restriction.\n\nThe no-restrict-websafe option instructs ssh-agent to permit  signatures  using  FIDO\nkeys that might be web authentication requests.  By default, ssh-agent refuses signa‐\nture  requests  for  FIDO  keys  where the key application string does not start with\n“ssh:” and when the data to be signed does not appear to be a ssh(1) user authentica‐\ntion request or a ssh-keygen(1) signature.  The default behaviour prevents  forwarded\naccess  to  a FIDO key from also implicitly forwarding the ability to authenticate to\nwebsites.\n",
                    "flag": "-O"
                },
                {
                    "name": "-P _",
                    "content": "Specify a pattern-list of acceptable paths for PKCS#11 provider and FIDO  authentica‐\ntor  middleware  shared  libraries  that  may  be  used  with the -S or -s options to\nssh-add(1).  Libraries that do not match the pattern list will be refused.  See  PAT‐\nTERNS in sshconfig(5) for a description of pattern-list syntax.  The default list is\n“usr/lib*/*,/usr/local/lib*/*”.\n",
                    "flag": "-P"
                },
                {
                    "name": "-s",
                    "content": "like it's a csh style of shell.\n",
                    "flag": "-s"
                },
                {
                    "name": "-t _",
                    "content": "Set  a  default value for the maximum lifetime of identities added to the agent.  The\nlifetime may be specified in seconds or in a time format specified in sshdconfig(5).\nA lifetime specified for an identity with ssh-add(1) overrides this  value.   Without\nthis option the default maximum lifetime is forever.\n\ncommand [arg ...]\nIf  a  command (and optional arguments) is given, this is executed as a subprocess of\nthe agent.  The agent exits automatically when the command given on the command  line\nterminates.\n\nThere  are  two main ways to get an agent set up.  The first is at the start of an X session,\nwhere all other windows or programs are started as children of the  ssh-agent  program.   The\nagent  starts  a  command  under  which  its  environment variables are exported, for example\nssh-agent xterm &.  When the command terminates, so does the agent.\n\nThe second method is used for a login session.  When ssh-agent  is  started,  it  prints  the\nshell  commands  required to set its environment variables, which in turn can be evaluated in\nthe calling shell, for example eval `ssh-agent -s`.\n\nIn both cases, ssh(1) looks at these environment variables and uses them to establish a  con‐\nnection to the agent.\n\nThe  agent  initially  does not have any private keys.  Keys are added using ssh-add(1) or by\nssh(1) when AddKeysToAgent is set in sshconfig(5).  Multiple identities  may  be  stored  in\nssh-agent concurrently and ssh(1) will automatically use them if present.  ssh-add(1) is also\nused to remove keys from ssh-agent and to query the keys that are held in one.\n\nConnections  to  ssh-agent  may be forwarded from further remote hosts using the -A option to\nssh(1) (but see the caveats documented therein), avoiding the need for authentication data to\nbe stored on other machines.  Authentication passphrases and private keys never go  over  the\nnetwork:  the connection to the agent is forwarded over SSH remote connections and the result\nis returned to the requester, allowing the user access to their identities  anywhere  in  the\nnetwork in a secure fashion.\n",
                    "flag": "-t"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "SSHAGENTPID  When  ssh-agent  starts, it stores the name of the agent's process ID (PID) in\nthis variable.\n\nSSHAUTHSOCK  When ssh-agent starts, it creates a Unix-domain socket and stores its pathname\nin this variable.  It is accessible only to the current user,  but  is  easily\nabused by root or another instance of the same user.\n\nIn Debian, ssh-agent is installed with the set-group-id bit set, to prevent ptrace(2) attacks\nretrieving  private key material.  This has the side-effect of causing the run-time linker to\nremove certain environment variables which might have security implications for  set-id  pro‐\ngrams,  including  LDPRELOAD,  LDLIBRARYPATH, and TMPDIR.  If you need to set any of these\nenvironment variables, you will need to do so in the program executed by ssh-agent.\n",
            "subsections": []
        },
        "FILES": {
            "content": "$TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>\nUnix-domain sockets used to contain  the  connection  to  the  authentication  agent.\nThese sockets should only be readable by the owner.  The sockets should get automati‐\ncally removed when the agent exits.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ssh(1), ssh-add(1), ssh-keygen(1), sshconfig(5), sshd(8)\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "OpenSSH  is  a  derivative of the original and free ssh 1.2.12 release by Tatu Ylonen.  Aaron\nCampbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt  and  Dug  Song  removed  many\nbugs, re-added newer features and created OpenSSH.  Markus Friedl contributed the support for\nSSH protocol versions 1.5 and 2.0.\n\nDebian                                     August 10, 2023                              SSH-AGENT(1)",
            "subsections": []
        }
    },
    "summary": "ssh-agent — OpenSSH authentication agent",
    "flags": [
        {
            "flag": "-a",
            "long": null,
            "arg": null,
            "description": "Bind the agent to the Unix-domain socket bindaddress. The default is $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>."
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "csh style of shell."
        },
        {
            "flag": "-D",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-d",
            "long": null,
            "arg": null,
            "description": "debug information to standard error."
        },
        {
            "flag": "-E",
            "long": null,
            "arg": null,
            "description": "Specifies the hash algorithm used when displaying key fingerprints. Valid options are: “md5” and “sha256”. The default is “sha256”."
        },
        {
            "flag": "-k",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-O",
            "long": null,
            "arg": null,
            "description": "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), 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) user authentica‐ tion request or a ssh-keygen(1) signature. The default behaviour prevents forwarded access to a FIDO key from also implicitly forwarding the ability to authenticate to websites."
        },
        {
            "flag": "-P",
            "long": null,
            "arg": null,
            "description": "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). Libraries that do not match the pattern list will be refused. See PAT‐ TERNS in sshconfig(5) for a description of pattern-list syntax. The default list is “usr/lib*/*,/usr/local/lib*/*”."
        },
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": "like it's a csh style of shell."
        },
        {
            "flag": "-t",
            "long": null,
            "arg": null,
            "description": "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 sshdconfig(5). A lifetime specified for an identity with ssh-add(1) 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) 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) or by ssh(1) when AddKeysToAgent is set in sshconfig(5). Multiple identities may be stored in ssh-agent concurrently and ssh(1) will automatically use them if present. ssh-add(1) 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) (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."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "ssh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ssh/1/json"
        },
        {
            "name": "ssh-add",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ssh-add/1/json"
        },
        {
            "name": "ssh-keygen",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ssh-keygen/1/json"
        },
        {
            "name": "sshconfig",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/sshconfig/5/json"
        },
        {
            "name": "sshd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sshd/8/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Spawn an SSH Agent process.",
        "examples": [
            {
                "description": "Start an SSH Agent for the current shell",
                "command": "eval $(ssh-agent)"
            },
            {
                "description": "Kill the currently running agent",
                "command": "ssh-agent -k"
            }
        ]
    }
}