ssh-agent.1 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. .\" $OpenBSD: ssh-agent.1,v 1.72 2020/06/22 05:52:05 djm Exp $
  2. .\"
  3. .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
  4. .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  5. .\" All rights reserved
  6. .\"
  7. .\" As far as I am concerned, the code I have written for this software
  8. .\" can be used freely for any purpose. Any derived versions of this
  9. .\" software must be clearly marked as such, and if the derived work is
  10. .\" incompatible with the protocol description in the RFC file, it must be
  11. .\" called by a name other than "ssh" or "Secure Shell".
  12. .\"
  13. .\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
  14. .\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
  15. .\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
  16. .\"
  17. .\" Redistribution and use in source and binary forms, with or without
  18. .\" modification, are permitted provided that the following conditions
  19. .\" are met:
  20. .\" 1. Redistributions of source code must retain the above copyright
  21. .\" notice, this list of conditions and the following disclaimer.
  22. .\" 2. Redistributions in binary form must reproduce the above copyright
  23. .\" notice, this list of conditions and the following disclaimer in the
  24. .\" documentation and/or other materials provided with the distribution.
  25. .\"
  26. .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  27. .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  28. .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  29. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  30. .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  31. .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  32. .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33. .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  34. .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  35. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. .\"
  37. .Dd $Mdocdate: June 22 2020 $
  38. .Dt SSH-AGENT 1
  39. .Os
  40. .Sh NAME
  41. .Nm ssh-agent
  42. .Nd OpenSSH authentication agent
  43. .Sh SYNOPSIS
  44. .Nm ssh-agent
  45. .Op Fl c | s
  46. .Op Fl \&Dd
  47. .Op Fl a Ar bind_address
  48. .Op Fl E Ar fingerprint_hash
  49. .Op Fl P Ar allowed_providers
  50. .Op Fl t Ar life
  51. .Nm ssh-agent
  52. .Op Fl a Ar bind_address
  53. .Op Fl E Ar fingerprint_hash
  54. .Op Fl P Ar allowed_providers
  55. .Op Fl t Ar life
  56. .Ar command Op Ar arg ...
  57. .Nm ssh-agent
  58. .Op Fl c | s
  59. .Fl k
  60. .Sh DESCRIPTION
  61. .Nm
  62. is a program to hold private keys used for public key authentication.
  63. Through use of environment variables the agent can be located
  64. and automatically used for authentication when logging in to other
  65. machines using
  66. .Xr ssh 1 .
  67. .Pp
  68. The options are as follows:
  69. .Bl -tag -width Ds
  70. .It Fl a Ar bind_address
  71. Bind the agent to the
  72. .Ux Ns -domain
  73. socket
  74. .Ar bind_address .
  75. The default is
  76. .Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt .
  77. .It Fl c
  78. Generate C-shell commands on
  79. .Dv stdout .
  80. This is the default if
  81. .Ev SHELL
  82. looks like it's a csh style of shell.
  83. .It Fl D
  84. Foreground mode.
  85. When this option is specified
  86. .Nm
  87. will not fork.
  88. .It Fl d
  89. Debug mode.
  90. When this option is specified
  91. .Nm
  92. will not fork and will write debug information to standard error.
  93. .It Fl E Ar fingerprint_hash
  94. Specifies the hash algorithm used when displaying key fingerprints.
  95. Valid options are:
  96. .Dq md5
  97. and
  98. .Dq sha256 .
  99. The default is
  100. .Dq sha256 .
  101. .It Fl k
  102. Kill the current agent (given by the
  103. .Ev SSH_AGENT_PID
  104. environment variable).
  105. .It Fl P Ar allowed_providers
  106. Specify a pattern-list of acceptable paths for PKCS#11 provider and FIDO
  107. authenticator middleware shared libraries that may be used with the
  108. .Fl S
  109. or
  110. .Fl s
  111. options to
  112. .Xr ssh-add 1 .
  113. Libraries that do not match the pattern list will be refused.
  114. See PATTERNS in
  115. .Xr ssh_config 5
  116. for a description of pattern-list syntax.
  117. The default list is
  118. .Dq /usr/lib/*,/usr/local/lib/* .
  119. .It Fl s
  120. Generate Bourne shell commands on
  121. .Dv stdout .
  122. This is the default if
  123. .Ev SHELL
  124. does not look like it's a csh style of shell.
  125. .It Fl t Ar life
  126. Set a default value for the maximum lifetime of identities added to the agent.
  127. The lifetime may be specified in seconds or in a time format specified in
  128. .Xr sshd_config 5 .
  129. A lifetime specified for an identity with
  130. .Xr ssh-add 1
  131. overrides this value.
  132. Without this option the default maximum lifetime is forever.
  133. .It Ar command Op Ar arg ...
  134. If a command (and optional arguments) is given,
  135. this is executed as a subprocess of the agent.
  136. The agent exits automatically when the command given on the command
  137. line terminates.
  138. .El
  139. .Pp
  140. There are two main ways to get an agent set up.
  141. The first is at the start of an X session,
  142. where all other windows or programs are started as children of the
  143. .Nm
  144. program.
  145. The agent starts a command under which its environment
  146. variables are exported, for example
  147. .Cm ssh-agent xterm & .
  148. When the command terminates, so does the agent.
  149. .Pp
  150. The second method is used for a login session.
  151. When
  152. .Nm
  153. is started,
  154. it prints the shell commands required to set its environment variables,
  155. which in turn can be evaluated in the calling shell, for example
  156. .Cm eval `ssh-agent -s` .
  157. .Pp
  158. In both cases,
  159. .Xr ssh 1
  160. looks at these environment variables and uses them to establish a connection to the agent.
  161. .Pp
  162. The agent initially does not have any private keys.
  163. Keys are added using
  164. .Xr ssh-add 1
  165. or by
  166. .Xr ssh 1
  167. when
  168. .Cm AddKeysToAgent
  169. is set in
  170. .Xr ssh_config 5 .
  171. Multiple identities may be stored in
  172. .Nm
  173. concurrently and
  174. .Xr ssh 1
  175. will automatically use them if present.
  176. .Xr ssh-add 1
  177. is also used to remove keys from
  178. .Nm
  179. and to query the keys that are held in one.
  180. .Pp
  181. Connections to
  182. .Nm
  183. may be forwarded from further remote hosts using the
  184. .Fl A
  185. option to
  186. .Xr ssh 1
  187. (but see the caveats documented therein),
  188. avoiding the need for authentication data to be stored on other machines.
  189. Authentication passphrases and private keys never go over the network:
  190. the connection to the agent is forwarded over SSH remote connections
  191. and the result is returned to the requester,
  192. allowing the user access to their identities anywhere in the network
  193. in a secure fashion.
  194. .Sh ENVIRONMENT
  195. .Bl -tag -width "SSH_AGENT_PID"
  196. .It Ev SSH_AGENT_PID
  197. When
  198. .Nm
  199. starts, it stores the name of the agent's process ID (PID) in this variable.
  200. .It Ev SSH_AUTH_SOCK
  201. When
  202. .Nm
  203. starts, it creates a
  204. .Ux Ns -domain
  205. socket and stores its pathname in this variable.
  206. It is accessible only to the current user,
  207. but is easily abused by root or another instance of the same user.
  208. .El
  209. .Pp
  210. In Debian,
  211. .Nm
  212. is installed with the set-group-id bit set, to prevent
  213. .Xr ptrace 2
  214. attacks retrieving private key material.
  215. This has the side-effect of causing the run-time linker to remove certain
  216. environment variables which might have security implications for set-id
  217. programs, including
  218. .Ev LD_PRELOAD ,
  219. .Ev LD_LIBRARY_PATH ,
  220. and
  221. .Ev TMPDIR .
  222. If you need to set any of these environment variables, you will need to do
  223. so in the program executed by ssh-agent.
  224. .Sh FILES
  225. .Bl -tag -width Ds
  226. .It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.<ppid>
  227. .Ux Ns -domain
  228. sockets used to contain the connection to the authentication agent.
  229. These sockets should only be readable by the owner.
  230. The sockets should get automatically removed when the agent exits.
  231. .El
  232. .Sh SEE ALSO
  233. .Xr ssh 1 ,
  234. .Xr ssh-add 1 ,
  235. .Xr ssh-keygen 1 ,
  236. .Xr ssh_config 5 ,
  237. .Xr sshd 8
  238. .Sh AUTHORS
  239. .An -nosplit
  240. OpenSSH is a derivative of the original and free ssh 1.2.12 release by
  241. .An Tatu Ylonen .
  242. .An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos , Theo de Raadt
  243. and
  244. .An Dug Song
  245. removed many bugs, re-added newer features and created OpenSSH.
  246. .An Markus Friedl
  247. contributed the support for SSH protocol versions 1.5 and 2.0.