2 .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
3 .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 .\" All rights reserved
6 .\" As far as I am concerned, the code I have written for this software
7 .\" can be used freely for any purpose. Any derived versions of this
8 .\" software must be clearly marked as such, and if the derived work is
9 .\" incompatible with the protocol description in the RFC file, it must be
10 .\" called by a name other than "ssh" or "Secure Shell".
12 .\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
13 .\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
14 .\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
16 .\" Redistribution and use in source and binary forms, with or without
17 .\" modification, are permitted provided that the following conditions
19 .\" 1. Redistributions of source code must retain the above copyright
20 .\" notice, this list of conditions and the following disclaimer.
21 .\" 2. Redistributions in binary form must reproduce the above copyright
22 .\" notice, this list of conditions and the following disclaimer in the
23 .\" documentation and/or other materials provided with the distribution.
25 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 .\" $OpenBSD: ssh.1,v 1.442 2024/06/27 21:02:16 jmc Exp $
37 .Dd $Mdocdate: June 27 2024 $
42 .Nd OpenSSH remote login client
45 .Op Fl 46AaCfGgKkMNnqsTtVvXxYy
46 .Op Fl B Ar bind_interface
47 .Op Fl b Ar bind_address
48 .Op Fl c Ar cipher_spec
49 .Op Fl D Oo Ar bind_address : Oc Ns Ar port
51 .Op Fl e Ar escape_char
52 .Op Fl F Ar configfile
54 .Op Fl i Ar identity_file
55 .Op Fl J Ar destination
57 .Op Fl l Ar login_name
65 .Op Fl W Ar host : Ns Ar port
66 .Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun
68 .Op Ar command Op Ar argument ...
70 .Op Fl Q Ar query_option
73 (SSH client) is a program for logging into a remote machine and for
74 executing commands on a remote machine.
75 It is intended to provide secure encrypted communications between
76 two untrusted hosts over an insecure network.
77 X11 connections, arbitrary TCP ports and
79 sockets can also be forwarded over the secure channel.
82 connects and logs into the specified
84 which may be specified as either
86 .Oo user @ Oc hostname
90 .No ssh:// Oo user @ Oc hostname Op : port .
93 their identity to the remote machine using one of several methods
99 it will be executed on the remote host instead of a login shell.
100 A complete command line may be specified as
102 or it may have additional arguments.
103 If supplied, the arguments will be appended to the command, separated by
104 spaces, before it is sent to the server to be executed.
106 The options are as follows:
108 .Bl -tag -width Ds -compact
112 to use IPv4 addresses only.
117 to use IPv6 addresses only.
120 Enables forwarding of connections from an authentication agent such as
122 This can also be specified on a per-host basis in a configuration file.
124 Agent forwarding should be enabled with caution.
125 Users with the ability to bypass file permissions on the remote host
128 socket) can access the local agent through the forwarded connection.
129 An attacker cannot obtain key material from the agent,
130 however they can perform operations on the keys that enable them to
131 authenticate using the identities loaded into the agent.
132 A safer alternative may be to use a jump host
137 Disables forwarding of the authentication agent connection.
139 .It Fl B Ar bind_interface
140 Bind to the address of
142 before attempting to connect to the destination host.
143 This is only useful on systems with more than one address.
145 .It Fl b Ar bind_address
148 on the local machine as the source address
150 Only useful on systems with more than one address.
153 Requests compression of all data (including stdin, stdout, stderr, and
154 data for forwarded X11, TCP and
157 The compression algorithm is the same used by
159 Compression is desirable on modem lines and other
160 slow connections, but will only slow down things on fast networks.
161 The default value can be set on a host-by-host basis in the
162 configuration files; see the
167 .It Fl c Ar cipher_spec
168 Selects the cipher specification for encrypting the session.
170 is a comma-separated list of ciphers
171 listed in order of preference.
176 for more information.
180 .Oo Ar bind_address : Oc
186 application-level port forwarding.
187 This works by allocating a socket to listen to
189 on the local side, optionally bound to the specified
191 Whenever a connection is made to this port, the
192 connection is forwarded over the secure channel, and the application
193 protocol is then used to determine where to connect to from the
195 Currently the SOCKS4 and SOCKS5 protocols are supported, and
197 will act as a SOCKS server.
198 Only root can forward privileged ports.
199 Dynamic port forwardings can also be specified in the configuration file.
201 IPv6 addresses can be specified by enclosing the address in square brackets.
202 Only the superuser can forward privileged ports.
203 By default, the local port is bound in accordance with the
208 may be used to bind the connection to a specific address.
213 indicates that the listening port be bound for local use only, while an
216 indicates that the port should be available from all interfaces.
221 instead of standard error.
223 .It Fl e Ar escape_char
224 Sets the escape character for sessions with a pty (default:
226 The escape character is only recognized at the beginning of a line.
227 The escape character followed by a dot
229 closes the connection;
230 followed by control-Z suspends the connection;
231 and followed by itself sends the escape character once.
232 Setting the character to
234 disables any escapes and makes the session fully transparent.
236 .It Fl F Ar configfile
237 Specifies an alternative per-user configuration file.
238 If a configuration file is given on the command line,
239 the system-wide configuration file
240 .Pq Pa /etc/ssh/ssh_config
242 The default for the per-user configuration file is
246 no configuration files will be read.
251 to go to background just before command execution.
254 is going to ask for passwords or passphrases, but the user
255 wants it in the background.
258 The recommended way to start X11 programs at a remote site is with
260 .Ic ssh -f host xterm .
263 .Cm ExitOnForwardFailure
264 configuration option is set to
266 then a client started with
268 will wait for all remote port forwards to be successfully established
269 before placing itself in the background.
270 Refer to the description of
271 .Cm ForkAfterAuthentication
279 to print its configuration after evaluating
286 Allows remote hosts to connect to local forwarded ports.
287 If used on a multiplexed connection, then this option must be specified
288 on the master process.
291 Specify the PKCS#11 shared library
293 should use to communicate with a PKCS#11 token providing keys for user
296 .It Fl i Ar identity_file
297 Selects a file from which the identity (private key) for
298 public key authentication is read.
299 You can also specify a public key file to use the corresponding
300 private key that is loaded in
302 when the private key file is not present locally.
305 .Pa ~/.ssh/id_ecdsa ,
306 .Pa ~/.ssh/id_ecdsa_sk ,
307 .Pa ~/.ssh/id_ed25519
309 .Pa ~/.ssh/id_ed25519_sk .
310 Identity files may also be specified on
311 a per-host basis in the configuration file.
312 It is possible to have multiple
314 options (and multiple identities specified in
315 configuration files).
316 If no certificates have been explicitly specified by the
320 will also try to load certificate information from the filename obtained
323 to identity filenames.
325 .It Fl J Ar destination
326 Connect to the target host by first making an
328 connection to the jump host described by
330 and then establishing a TCP forwarding to the ultimate destination from
332 Multiple jump hops may be specified separated by comma characters.
333 IPv6 addresses can be specified by enclosing the address in square brackets.
334 This is a shortcut to specify a
336 configuration directive.
337 Note that configuration directives supplied on the command-line generally
338 apply to the destination host and not any specified jump hosts.
341 to specify configuration for jump hosts.
344 Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
345 credentials to the server.
348 Disables forwarding (delegation) of GSSAPI credentials to the server.
352 .Oo Ar bind_address : Oc
353 .Ar port : host : hostport
358 .Oo Ar bind_address : Oc
359 .Ar port : remote_socket
364 .Ar local_socket : host : hostport
369 .Ar local_socket : remote_socket
372 Specifies that connections to the given TCP port or Unix socket on the local
373 (client) host are to be forwarded to the given host and port, or Unix socket,
375 This works by allocating a socket to listen to either a TCP
377 on the local side, optionally bound to the specified
380 Whenever a connection is made to the local port or socket, the
381 connection is forwarded over the secure channel, and a connection is
388 from the remote machine.
390 Port forwardings can also be specified in the configuration file.
391 Only the superuser can forward privileged ports.
392 IPv6 addresses can be specified by enclosing the address in square brackets.
394 By default, the local port is bound in accordance with the
399 may be used to bind the connection to a specific address.
404 indicates that the listening port be bound for local use only, while an
407 indicates that the port should be available from all interfaces.
409 .It Fl l Ar login_name
410 Specifies the user to log in as on the remote machine.
411 This also may be specified on a per-host basis in the configuration file.
418 mode for connection sharing.
425 mode but with confirmation required using
427 before each operation that changes the multiplexing state
428 (e.g. opening a new session).
429 Refer to the description of
436 A comma-separated list of MAC (message authentication code) algorithms,
437 specified in order of preference.
442 for more information.
445 Do not execute a remote command.
446 This is useful for just forwarding ports.
447 Refer to the description of
456 (actually, prevents reading from stdin).
457 This must be used when
459 is run in the background.
460 A common trick is to use this to run X11 programs on a remote machine.
462 .Ic ssh -n shadows.cs.hut.fi emacs &
463 will start an emacs on shadows.cs.hut.fi, and the X11
464 connection will be automatically forwarded over an encrypted channel.
467 program will be put in the background.
468 (This does not work if
470 needs to ask for a password or passphrase; see also the
473 Refer to the description of
480 Control an active connection multiplexing master process.
483 option is specified, the
485 argument is interpreted and passed to the master process.
488 (check that the master process is running),
490 (request forwardings without command execution),
492 (cancel forwardings),
494 (request the master to exit), and
496 (request the master to stop accepting further multiplexing requests).
499 Can be used to give options in the format used in the configuration file.
500 This is useful for specifying options for which there is no separate
502 For full details of the options listed below, and their possible values, see
505 .Bl -tag -width Ds -offset indent -compact
511 .It CanonicalizeFallbackLocal
512 .It CanonicalizeHostname
513 .It CanonicalizeMaxDots
514 .It CanonicalizePermittedCNAMEs
515 .It CASignatureAlgorithms
519 .It ClearAllForwardings
521 .It ConnectionAttempts
527 .It EnableEscapeCommandline
529 .It ExitOnForwardFailure
531 .It ForkAfterAuthentication
534 .It ForwardX11Timeout
535 .It ForwardX11Trusted
537 .It GlobalKnownHostsFile
538 .It GSSAPIAuthentication
539 .It GSSAPIDelegateCredentials
542 .It HostbasedAcceptedAlgorithms
543 .It HostbasedAuthentication
544 .It HostKeyAlgorithms
551 .It KbdInteractiveAuthentication
552 .It KbdInteractiveDevices
554 .It KnownHostsCommand
560 .It NoHostAuthenticationForLocalhost
561 .It NumberOfPasswordPrompts
562 .It PasswordAuthentication
563 .It PermitLocalCommand
567 .It PreferredAuthentications
571 .It PubkeyAcceptedAlgorithms
572 .It PubkeyAuthentication
579 .It ServerAliveInterval
580 .It ServerAliveCountMax
584 .It StreamLocalBindMask
585 .It StreamLocalBindUnlink
586 .It StrictHostKeyChecking
592 .It UserKnownHostsFile
599 Specify a tag name that may be used to select configuration in
607 for more information.
609 Port to connect to on the remote host.
610 This can be specified on a
611 per-host basis in the configuration file.
613 .It Fl Q Ar query_option
614 Queries for the algorithms supported by one of the following features:
616 (supported symmetric ciphers),
618 (supported symmetric ciphers that support authenticated encryption),
620 (supported query terms for use with the
624 (supported message integrity codes),
626 (key exchange algorithms),
630 (valid CA signature algorithms for certificates),
632 (certificate key types),
634 (non-certificate key types),
636 (all key types and signature algorithms),
638 (supported SSH protocol versions), and
640 (supported signature algorithms).
641 Alternatively, any keyword from
645 that takes an algorithm list may be used as an alias for the corresponding
650 Causes most warning and diagnostic messages to be suppressed.
654 .Oo Ar bind_address : Oc
655 .Ar port : host : hostport
660 .Oo Ar bind_address : Oc
661 .Ar port : local_socket
666 .Ar remote_socket : host : hostport
671 .Ar remote_socket : local_socket
676 .Oo Ar bind_address : Oc
680 Specifies that connections to the given TCP port or Unix socket on the remote
681 (server) host are to be forwarded to the local side.
683 This works by allocating a socket to listen to either a TCP
685 or to a Unix socket on the remote side.
686 Whenever a connection is made to this port or Unix socket, the
687 connection is forwarded over the secure channel, and a connection
688 is made from the local machine to either an explicit destination specified by
694 or, if no explicit destination was specified,
696 will act as a SOCKS 4/5 proxy and forward connections to the destinations
697 requested by the remote SOCKS client.
699 Port forwardings can also be specified in the configuration file.
700 Privileged ports can be forwarded only when
701 logging in as root on the remote machine.
702 IPv6 addresses can be specified by enclosing the address in square brackets.
704 By default, TCP listening sockets on the server will be bound to the loopback
706 This may be overridden by specifying a
712 indicates that the remote socket should listen on all interfaces.
715 will only succeed if the server's
717 option is enabled (see
718 .Xr sshd_config 5 ) .
724 the listen port will be dynamically allocated on the server and reported
725 to the client at run time.
726 When used together with
728 the allocated port will be printed to the standard output.
731 Specifies the location of a control socket for connection sharing,
734 to disable connection sharing.
735 Refer to the description of
744 May be used to request invocation of a subsystem on the remote system.
745 Subsystems facilitate the use of SSH
746 as a secure transport for other applications (e.g.\&
748 The subsystem is specified as the remote command.
749 Refer to the description of
756 Disable pseudo-terminal allocation.
759 Force pseudo-terminal allocation.
760 This can be used to execute arbitrary
761 screen-based programs on a remote machine, which can be very useful,
762 e.g. when implementing menu services.
765 options force tty allocation, even if
770 Display the version number and exit.
776 to print debugging messages about its progress.
778 debugging connection, authentication, and configuration problems.
781 options increase the verbosity.
784 .It Fl W Ar host : Ns Ar port
785 Requests that standard input and output on the client be forwarded to
789 over the secure channel.
793 .Cm ExitOnForwardFailure
795 .Cm ClearAllForwardings ,
796 though these can be overridden in the configuration file or using
798 command line options.
801 .Ar local_tun Ns Op : Ns Ar remote_tun
805 device forwarding with the specified
807 devices between the client
812 The devices may be specified by numerical ID or the keyword
814 which uses the next available tunnel device.
817 is not specified, it defaults to
828 directive is unset, it will be set to the default tunnel mode, which is
832 forwarding mode it desired, then it should be specified before
836 Enables X11 forwarding.
837 This can also be specified on a per-host basis in a configuration file.
839 X11 forwarding should be enabled with caution.
840 Users with the ability to bypass file permissions on the remote host
841 (for the user's X authorization database)
842 can access the local X11 display through the forwarded connection.
843 An attacker may then be able to perform activities such as keystroke monitoring.
845 For this reason, X11 forwarding is subjected to X11 SECURITY extension
846 restrictions by default.
851 .Cm ForwardX11Trusted
854 for more information.
857 Disables X11 forwarding.
860 Enables trusted X11 forwarding.
861 Trusted X11 forwardings are not subjected to the X11 SECURITY extension
865 Send log information using the
868 By default this information is sent to stderr.
872 may additionally obtain configuration data from
873 a per-user configuration file and a system-wide configuration file.
874 The file format and configuration options are described in
877 The OpenSSH SSH client supports SSH protocol 2.
879 The methods available for authentication are:
880 GSSAPI-based authentication,
881 host-based authentication,
882 public key authentication,
883 keyboard-interactive authentication,
884 and password authentication.
885 Authentication methods are tried in the order specified above,
887 .Cm PreferredAuthentications
888 can be used to change the default order.
890 Host-based authentication works as follows:
891 If the machine the user logs in from is listed in
894 .Pa /etc/shosts.equiv
895 on the remote machine, the user is non-root and the user names are
896 the same on both sides, or if the files
900 exist in the user's home directory on the
901 remote machine and contain a line containing the name of the client
902 machine and the name of the user on that machine, the user is
903 considered for login.
904 Additionally, the server
906 be able to verify the client's
907 host key (see the description of
908 .Pa /etc/ssh/ssh_known_hosts
910 .Pa ~/.ssh/known_hosts ,
912 for login to be permitted.
913 This authentication method closes security holes due to IP
914 spoofing, DNS spoofing, and routing spoofing.
915 [Note to the administrator:
916 .Pa /etc/hosts.equiv ,
918 and the rlogin/rsh protocol in general, are inherently insecure and should be
919 disabled if security is desired.]
921 Public key authentication works as follows:
922 The scheme is based on public-key cryptography,
924 where encryption and decryption are done using separate keys,
925 and it is unfeasible to derive the decryption key from the encryption key.
926 The idea is that each user creates a public/private
927 key pair for authentication purposes.
928 The server knows the public key, and only the user knows the private key.
930 implements public key authentication protocol automatically,
931 using one of the ECDSA, Ed25519 or RSA algorithms.
934 .Pa ~/.ssh/authorized_keys
935 lists the public keys that are permitted for logging in.
936 When the user logs in, the
938 program tells the server which key pair it would like to use for
940 The client proves that it has access to the private key
941 and the server checks that the corresponding public key
942 is authorized to accept the account.
944 The server may inform the client of errors that prevented public key
945 authentication from succeeding after authentication completes using a
947 These may be viewed by increasing the
951 or higher (e.g. by using the
955 The user creates their key pair by running
957 This stores the private key in
960 .Pa ~/.ssh/id_ecdsa_sk
961 (authenticator-hosted ECDSA),
962 .Pa ~/.ssh/id_ed25519
964 .Pa ~/.ssh/id_ed25519_sk
965 (authenticator-hosted Ed25519),
969 and stores the public key in
970 .Pa ~/.ssh/id_ecdsa.pub
972 .Pa ~/.ssh/id_ecdsa_sk.pub
973 (authenticator-hosted ECDSA),
974 .Pa ~/.ssh/id_ed25519.pub
976 .Pa ~/.ssh/id_ed25519_sk.pub
977 (authenticator-hosted Ed25519),
979 .Pa ~/.ssh/id_rsa.pub
981 in the user's home directory.
982 The user should then copy the public key
984 .Pa ~/.ssh/authorized_keys
985 in their home directory on the remote machine.
988 file corresponds to the conventional
990 file, and has one key
991 per line, though the lines can be very long.
992 After this, the user can log in without giving the password.
994 A variation on public key authentication
995 is available in the form of certificate authentication:
996 instead of a set of public/private keys,
997 signed certificates are used.
998 This has the advantage that a single trusted certification authority
999 can be used in place of many public/private keys.
1000 See the CERTIFICATES section of
1002 for more information.
1004 The most convenient way to use public key or certificate authentication
1005 may be with an authentication agent.
1008 and (optionally) the
1012 for more information.
1014 Keyboard-interactive authentication works as follows:
1015 The server sends an arbitrary
1017 text and prompts for a response, possibly multiple times.
1018 Examples of keyboard-interactive authentication include
1026 Finally, if other authentication methods fail,
1028 prompts the user for a password.
1029 The password is sent to the remote
1030 host for checking; however, since all communications are encrypted,
1031 the password cannot be seen by someone listening on the network.
1034 automatically maintains and checks a database containing
1035 identification for all hosts it has ever been used with.
1036 Host keys are stored in
1037 .Pa ~/.ssh/known_hosts
1038 in the user's home directory.
1039 Additionally, the file
1040 .Pa /etc/ssh/ssh_known_hosts
1041 is automatically checked for known hosts.
1042 Any new hosts are automatically added to the user's file.
1043 If a host's identification ever changes,
1045 warns about this and disables password authentication to prevent
1046 server spoofing or man-in-the-middle attacks,
1047 which could otherwise be used to circumvent the encryption.
1049 .Cm StrictHostKeyChecking
1050 option can be used to control logins to machines whose
1051 host key is not known or has changed.
1053 When the user's identity has been accepted by the server, the server
1054 either executes the given command in a non-interactive session or,
1055 if no command has been specified, logs into the machine and gives
1056 the user a normal shell as an interactive session.
1057 All communication with
1058 the remote command or shell will be automatically encrypted.
1060 If an interactive session is requested,
1062 by default will only request a pseudo-terminal (pty) for interactive
1063 sessions when the client has one.
1068 can be used to override this behaviour.
1070 If a pseudo-terminal has been allocated, the
1071 user may use the escape characters noted below.
1073 If no pseudo-terminal has been allocated,
1074 the session is transparent and can be used to reliably transfer binary data.
1075 On most systems, setting the escape character to
1077 will also make the session transparent even if a tty is used.
1079 The session terminates when the command or shell on the remote
1080 machine exits and all X11 and TCP connections have been closed.
1081 .Sh ESCAPE CHARACTERS
1082 When a pseudo-terminal has been requested,
1084 supports a number of functions through the use of an escape character.
1086 A single tilde character can be sent as
1088 or by following the tilde by a character other than those described below.
1089 The escape character must always follow a newline to be interpreted as
1091 The escape character can be changed in configuration files using the
1093 configuration directive or on the command line by the
1097 The supported escapes (assuming the default
1107 List forwarded connections.
1111 at logout when waiting for forwarded connection / X11 sessions to terminate.
1113 Display a list of escape characters.
1115 Send a BREAK to the remote system
1116 (only useful if the peer supports it).
1119 Currently this allows the addition of port forwardings using the
1124 options (see above).
1125 It also allows the cancellation of existing port-forwardings
1128 .Fl KL Oo Ar bind_address : Oc Ar port
1132 .Fl KR Oo Ar bind_address : Oc Ar port
1136 .Fl KD Oo Ar bind_address : Oc Ar port
1138 for dynamic port-forwardings.
1139 .Ic !\& Ns Ar command
1140 allows the user to execute a local command if the
1141 .Ic PermitLocalCommand
1142 option is enabled in
1144 Basic help is available, using the
1148 Request rekeying of the connection
1149 (only useful if the peer supports it).
1151 Decrease the verbosity
1153 when errors are being written to stderr.
1155 Increase the verbosity
1157 when errors are being written to stderr.
1160 Forwarding of arbitrary TCP connections over a secure channel
1161 can be specified either on the command line or in a configuration file.
1162 One possible application of TCP forwarding is a secure connection to a
1163 mail server; another is going through firewalls.
1165 In the example below, we look at encrypting communication for an IRC client,
1166 even though the IRC server it connects to does not directly
1167 support encrypted communication.
1168 This works as follows:
1169 the user connects to the remote host using
1171 specifying the ports to be used to forward the connection.
1172 After that it is possible to start the program locally,
1175 will encrypt and forward the connection to the remote server.
1177 The following example tunnels an IRC session from the client
1179 .Dq server.example.com ,
1184 using the standard IRC port, 6667:
1185 .Bd -literal -offset 4n
1186 $ ssh -f -L 6667:localhost:6667 server.example.com sleep 10
1187 $ irc -c '#users' pinky IRC/127.0.0.1
1194 and the remote command
1196 is specified to allow an amount of time
1197 (10 seconds, in the example)
1198 to start the program which is going to use the tunnel.
1199 If no connections are made within the time specified,
1207 (or see the description of the
1213 and the user is using X11 (the
1215 environment variable is set), the connection to the X11 display is
1216 automatically forwarded to the remote side in such a way that any X11
1217 programs started from the shell (or command) will go through the
1218 encrypted channel, and the connection to the real X server will be made
1219 from the local machine.
1220 The user should not manually set
1222 Forwarding of X11 connections can be
1223 configured on the command line or in configuration files.
1229 will point to the server machine, but with a display number greater than zero.
1230 This is normal, and happens because
1234 X server on the server machine for forwarding the
1235 connections over the encrypted channel.
1238 will also automatically set up Xauthority data on the server machine.
1239 For this purpose, it will generate a random authorization cookie,
1240 store it in Xauthority on the server, and verify that any forwarded
1241 connections carry this cookie and replace it by the real cookie when
1242 the connection is opened.
1243 The real authentication cookie is never
1244 sent to the server machine (and no cookies are sent in the plain).
1250 (or see the description of the
1255 the user is using an authentication agent, the connection to the agent
1256 is automatically forwarded to the remote side.
1257 .Sh VERIFYING HOST KEYS
1258 When connecting to a server for the first time,
1259 a fingerprint of the server's public key is presented to the user
1261 .Cm StrictHostKeyChecking
1263 Fingerprints can be determined using
1266 .Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1268 If the fingerprint is already known, it can be matched
1269 and the key can be accepted or rejected.
1270 If only legacy (MD5) fingerprints for the server are available, the
1273 option may be used to downgrade the fingerprint algorithm to match.
1275 Because of the difficulty of comparing host keys
1276 just by looking at fingerprint strings,
1277 there is also support to compare host keys visually,
1284 a small ASCII graphic gets displayed on every login to a server, no matter
1285 if the session itself is interactive or not.
1286 By learning the pattern a known server produces, a user can easily
1287 find out that the host key has changed when a completely different pattern
1289 Because these patterns are not unambiguous however, a pattern that looks
1290 similar to the pattern remembered only gives a good probability that the
1291 host key is the same, not guaranteed proof.
1293 To get a listing of the fingerprints along with their random art for
1294 all known hosts, the following command line can be used:
1296 .Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts
1298 If the fingerprint is unknown,
1299 an alternative method of verification is available:
1300 SSH fingerprints verified by DNS.
1301 An additional resource record (RR),
1303 is added to a zonefile
1304 and the connecting client is able to match the fingerprint
1305 with that of the key presented.
1307 In this example, we are connecting a client to a server,
1308 .Dq host.example.com .
1309 The SSHFP resource records should first be added to the zonefile for
1311 .Bd -literal -offset indent
1312 $ ssh-keygen -r host.example.com.
1315 The output lines will have to be added to the zonefile.
1316 To check that the zone is answering fingerprint queries:
1318 .Dl $ dig -t SSHFP host.example.com
1320 Finally the client connects:
1321 .Bd -literal -offset indent
1322 $ ssh -o "VerifyHostKeyDNS ask" host.example.com
1324 Matching host key fingerprint found in DNS.
1325 Are you sure you want to continue connecting (yes/no)?
1329 .Cm VerifyHostKeyDNS
1332 for more information.
1333 .Sh SSH-BASED VIRTUAL PRIVATE NETWORKS
1335 contains support for Virtual Private Network (VPN) tunnelling
1338 network pseudo-device,
1339 allowing two networks to be joined securely.
1342 configuration option
1344 controls whether the server supports this,
1345 and at what level (layer 2 or 3 traffic).
1347 The following example would connect client network 10.0.50.0/24
1348 with remote network 10.0.99.0/24 using a point-to-point connection
1349 from 10.1.1.1 to 10.1.1.2,
1350 provided that the SSH server running on the gateway to the remote network,
1351 at 192.168.1.15, allows it.
1354 .Bd -literal -offset indent
1355 # ssh -f -w 0:1 192.168.1.15 true
1356 # ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
1357 # route add 10.0.99.0/24 10.1.1.2
1361 .Bd -literal -offset indent
1362 # ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
1363 # route add 10.0.50.0/24 10.1.1.1
1366 Client access may be more finely tuned via the
1367 .Pa /root/.ssh/authorized_keys
1368 file (see below) and the
1371 The following entry would permit connections on
1375 and on tun device 2 from user
1380 .Dq forced-commands-only :
1381 .Bd -literal -offset 2n
1382 tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
1383 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
1386 Since an SSH-based setup entails a fair amount of overhead,
1387 it may be more suited to temporary setups,
1388 such as for wireless VPNs.
1389 More permanent VPNs are better provided by tools such as
1395 will normally set the following environment variables:
1396 .Bl -tag -width "SSH_ORIGINAL_COMMAND"
1400 variable indicates the location of the X11 server.
1401 It is automatically set by
1403 to point to a value of the form
1407 indicates the host where the shell runs, and
1409 is an integer \*(Ge 1.
1411 uses this special value to forward X11 connections over the secure
1413 The user should normally not set
1416 will render the X11 connection insecure (and will require the user to
1417 manually copy any required authorization cookies).
1419 Set to the path of the user's home directory.
1423 set for compatibility with systems that use this variable.
1425 Set to the path of the user's mailbox.
1429 as specified when compiling
1434 needs a passphrase, it will read the passphrase from the current
1435 terminal if it was run from a terminal.
1438 does not have a terminal associated with it but
1442 are set, it will execute the program specified by
1444 and open an X11 window to read the passphrase.
1445 This is particularly useful when calling
1450 (Note that on some machines it
1451 may be necessary to redirect the input from
1454 .It Ev SSH_ASKPASS_REQUIRE
1455 Allows further control over the use of an askpass program.
1456 If this variable is set to
1460 will never attempt to use one.
1465 will prefer to use the askpass program instead of the TTY when requesting
1467 Finally, if the variable is set to
1469 then the askpass program will be used for all passphrase input regardless
1473 .It Ev SSH_AUTH_SOCK
1474 Identifies the path of a
1476 socket used to communicate with the agent.
1477 .It Ev SSH_CONNECTION
1478 Identifies the client and server ends of the connection.
1479 The variable contains
1480 four space-separated values: client IP address, client port number,
1481 server IP address, and server port number.
1482 .It Ev SSH_ORIGINAL_COMMAND
1483 This variable contains the original command line if a forced command
1485 It can be used to extract the original arguments.
1487 This is set to the name of the tty (path to the device) associated
1488 with the current shell or command.
1489 If the current session has no tty,
1490 this variable is not set.
1494 to contain the interface names assigned if tunnel forwarding was
1495 requested by the client.
1496 .It Ev SSH_USER_AUTH
1499 this variable may contain a pathname to a file that lists the authentication
1500 methods successfully used when the session was established, including any
1501 public keys that were used.
1503 This variable is set to indicate the present time zone if it
1504 was set when the daemon was started (i.e. the daemon passes the value
1505 on to new connections).
1507 Set to the name of the user logging in.
1513 .Pa ~/.ssh/environment ,
1514 and adds lines of the format
1516 to the environment if the file exists and users are allowed to
1517 change their environment.
1518 For more information, see the
1519 .Cm PermitUserEnvironment
1523 .Bl -tag -width Ds -compact
1525 This file is used for host-based authentication (see above).
1526 On some machines this file may need to be
1527 world-readable if the user's home directory is on an NFS partition,
1531 Additionally, this file must be owned by the user,
1532 and must not have write permissions for anyone else.
1534 permission for most machines is read/write for the user, and not
1535 accessible by others.
1538 This file is used in exactly the same way as
1540 but allows host-based authentication without permitting login with
1544 This directory is the default location for all user-specific configuration
1545 and authentication information.
1546 There is no general requirement to keep the entire contents of this directory
1547 secret, but the recommended permissions are read/write/execute for the user,
1548 and not accessible by others.
1550 .It Pa ~/.ssh/authorized_keys
1551 Lists the public keys (ECDSA, Ed25519, RSA)
1552 that can be used for logging in as this user.
1553 The format of this file is described in the
1556 This file is not highly sensitive, but the recommended
1557 permissions are read/write for the user, and not accessible by others.
1559 .It Pa ~/.ssh/config
1560 This is the per-user configuration file.
1561 The file format and configuration options are described in
1563 Because of the potential for abuse, this file must have strict permissions:
1564 read/write for the user, and not writable by others.
1566 .It Pa ~/.ssh/environment
1567 Contains additional definitions for environment variables; see
1571 .It Pa ~/.ssh/id_ecdsa
1572 .It Pa ~/.ssh/id_ecdsa_sk
1573 .It Pa ~/.ssh/id_ed25519
1574 .It Pa ~/.ssh/id_ed25519_sk
1575 .It Pa ~/.ssh/id_rsa
1576 Contains the private key for authentication.
1578 contain sensitive data and should be readable by the user but not
1579 accessible by others (read/write/execute).
1581 will simply ignore a private key file if it is accessible by others.
1582 It is possible to specify a passphrase when
1583 generating the key which will be used to encrypt the
1584 sensitive part of this file using AES-128.
1586 .It Pa ~/.ssh/id_ecdsa.pub
1587 .It Pa ~/.ssh/id_ecdsa_sk.pub
1588 .It Pa ~/.ssh/id_ed25519.pub
1589 .It Pa ~/.ssh/id_ed25519_sk.pub
1590 .It Pa ~/.ssh/id_rsa.pub
1591 Contains the public key for authentication.
1593 sensitive and can (but need not) be readable by anyone.
1595 .It Pa ~/.ssh/known_hosts
1596 Contains a list of host keys for all hosts the user has logged into
1597 that are not already in the systemwide list of known host keys.
1600 for further details of the format of this file.
1603 Commands in this file are executed by
1605 when the user logs in, just before the user's shell (or command) is
1609 manual page for more information.
1611 .It Pa /etc/hosts.equiv
1612 This file is for host-based authentication (see above).
1613 It should only be writable by root.
1615 .It Pa /etc/shosts.equiv
1616 This file is used in exactly the same way as
1618 but allows host-based authentication without permitting login with
1621 .It Pa /etc/ssh/ssh_config
1622 Systemwide configuration file.
1623 The file format and configuration options are described in
1626 .It Pa /etc/ssh/ssh_host_ecdsa_key
1627 .It Pa /etc/ssh/ssh_host_ed25519_key
1628 .It Pa /etc/ssh/ssh_host_rsa_key
1629 These files contain the private parts of the host keys
1630 and are used for host-based authentication.
1632 .It Pa /etc/ssh/ssh_known_hosts
1633 Systemwide list of known host keys.
1634 This file should be prepared by the
1635 system administrator to contain the public host keys of all machines in the
1637 It should be world-readable.
1640 for further details of the format of this file.
1642 .It Pa /etc/ssh/sshrc
1643 Commands in this file are executed by
1645 when the user logs in, just before the user's shell (or command) is started.
1648 manual page for more information.
1652 exits with the exit status of the remote command or with 255
1653 if an error occurred.
1671 .%T The Secure Shell (SSH) Protocol Assigned Numbers
1679 .%T The Secure Shell (SSH) Protocol Architecture
1687 .%T The Secure Shell (SSH) Authentication Protocol
1695 .%T The Secure Shell (SSH) Transport Layer Protocol
1703 .%T The Secure Shell (SSH) Connection Protocol
1711 .%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
1719 .%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
1727 .%T The Secure Shell (SSH) Session Channel Break Extension
1736 .%T The Secure Shell (SSH) Transport Layer Encryption Modes
1743 .%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol
1752 .%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
1760 .%T The Secure Shell (SSH) Public Key File Format
1768 .%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
1775 .%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)
1776 .%T Hash Visualization: a New Technique to improve Real-World Security
1779 OpenSSH is a derivative of the original and free
1780 ssh 1.2.12 release by Tatu Ylonen.
1781 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1782 Theo de Raadt and Dug Song
1783 removed many bugs, re-added newer features and
1785 Markus Friedl contributed the support for SSH
1786 protocol versions 1.5 and 2.0.