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.425 2021/07/28 05:57:42 jmc Exp $
38 .Dd $Mdocdate: July 28 2021 $
43 .Nd OpenSSH remote login client
46 .Op Fl 46AaCfGgKkMNnqsTtVvXxYy
47 .Op Fl B Ar bind_interface
48 .Op Fl b Ar bind_address
49 .Op Fl c Ar cipher_spec
50 .Op Fl D Oo Ar bind_address : Oc Ns Ar port
52 .Op Fl e Ar escape_char
53 .Op Fl F Ar configfile
55 .Op Fl i Ar identity_file
56 .Op Fl J Ar destination
58 .Op Fl l Ar login_name
63 .Op Fl Q Ar query_option
66 .Op Fl W Ar host : Ns Ar port
67 .Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun
72 (SSH client) is a program for logging into a remote machine and for
73 executing commands on a remote machine.
74 It is intended to provide secure encrypted communications between
75 two untrusted hosts over an insecure network.
76 X11 connections, arbitrary TCP ports and
78 sockets can also be forwarded over the secure channel.
81 connects and logs into the specified
83 which may be specified as either
85 .Oo user @ Oc hostname
89 .No ssh:// Oo user @ Oc hostname Op : port .
92 their identity to the remote machine using one of several methods
98 it is executed on the remote host instead of a login shell.
100 The options are as follows:
102 .Bl -tag -width Ds -compact
106 to use IPv4 addresses only.
111 to use IPv6 addresses only.
114 Enables forwarding of connections from an authentication agent such as
116 This can also be specified on a per-host basis in a configuration file.
118 Agent forwarding should be enabled with caution.
119 Users with the ability to bypass file permissions on the remote host
122 socket) can access the local agent through the forwarded connection.
123 An attacker cannot obtain key material from the agent,
124 however they can perform operations on the keys that enable them to
125 authenticate using the identities loaded into the agent.
126 A safer alternative may be to use a jump host
131 Disables forwarding of the authentication agent connection.
133 .It Fl B Ar bind_interface
134 Bind to the address of
136 before attempting to connect to the destination host.
137 This is only useful on systems with more than one address.
139 .It Fl b Ar bind_address
142 on the local machine as the source address
144 Only useful on systems with more than one address.
147 Requests compression of all data (including stdin, stdout, stderr, and
148 data for forwarded X11, TCP and
151 The compression algorithm is the same used by
153 Compression is desirable on modem lines and other
154 slow connections, but will only slow down things on fast networks.
155 The default value can be set on a host-by-host basis in the
156 configuration files; see the
160 .It Fl c Ar cipher_spec
161 Selects the cipher specification for encrypting the session.
163 is a comma-separated list of ciphers
164 listed in order of preference.
169 for more information.
173 .Oo Ar bind_address : Oc
179 application-level port forwarding.
180 This works by allocating a socket to listen to
182 on the local side, optionally bound to the specified
184 Whenever a connection is made to this port, the
185 connection is forwarded over the secure channel, and the application
186 protocol is then used to determine where to connect to from the
188 Currently the SOCKS4 and SOCKS5 protocols are supported, and
190 will act as a SOCKS server.
191 Only root can forward privileged ports.
192 Dynamic port forwardings can also be specified in the configuration file.
194 IPv6 addresses can be specified by enclosing the address in square brackets.
195 Only the superuser can forward privileged ports.
196 By default, the local port is bound in accordance with the
201 may be used to bind the connection to a specific address.
206 indicates that the listening port be bound for local use only, while an
209 indicates that the port should be available from all interfaces.
214 instead of standard error.
216 .It Fl e Ar escape_char
217 Sets the escape character for sessions with a pty (default:
219 The escape character is only recognized at the beginning of a line.
220 The escape character followed by a dot
222 closes the connection;
223 followed by control-Z suspends the connection;
224 and followed by itself sends the escape character once.
225 Setting the character to
227 disables any escapes and makes the session fully transparent.
229 .It Fl F Ar configfile
230 Specifies an alternative per-user configuration file.
231 If a configuration file is given on the command line,
232 the system-wide configuration file
233 .Pq Pa /etc/ssh/ssh_config
235 The default for the per-user configuration file is
239 no configuration files will be read.
244 to go to background just before command execution.
247 is going to ask for passwords or passphrases, but the user
248 wants it in the background.
251 The recommended way to start X11 programs at a remote site is with
253 .Ic ssh -f host xterm .
256 .Cm ExitOnForwardFailure
257 configuration option is set to
259 then a client started with
261 will wait for all remote port forwards to be successfully established
262 before placing itself in the background.
263 Refer to the description of
264 .Cm ForkAfterAuthentication
272 to print its configuration after evaluating
279 Allows remote hosts to connect to local forwarded ports.
280 If used on a multiplexed connection, then this option must be specified
281 on the master process.
284 Specify the PKCS#11 shared library
286 should use to communicate with a PKCS#11 token providing keys for user
289 .It Fl i Ar identity_file
290 Selects a file from which the identity (private key) for
291 public key authentication is read.
294 .Pa ~/.ssh/id_ecdsa ,
295 .Pa ~/.ssh/id_ecdsa_sk ,
296 .Pa ~/.ssh/id_ed25519 ,
297 .Pa ~/.ssh/id_ed25519_sk
300 Identity files may also be specified on
301 a per-host basis in the configuration file.
302 It is possible to have multiple
304 options (and multiple identities specified in
305 configuration files).
306 If no certificates have been explicitly specified by the
310 will also try to load certificate information from the filename obtained
313 to identity filenames.
315 .It Fl J Ar destination
316 Connect to the target host by first making a
318 connection to the jump host described by
320 and then establishing a TCP forwarding to the ultimate destination from
322 Multiple jump hops may be specified separated by comma characters.
323 This is a shortcut to specify a
325 configuration directive.
326 Note that configuration directives supplied on the command-line generally
327 apply to the destination host and not any specified jump hosts.
330 to specify configuration for jump hosts.
333 Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
334 credentials to the server.
337 Disables forwarding (delegation) of GSSAPI credentials to the server.
341 .Oo Ar bind_address : Oc
342 .Ar port : host : hostport
347 .Oo Ar bind_address : Oc
348 .Ar port : remote_socket
353 .Ar local_socket : host : hostport
358 .Ar local_socket : remote_socket
361 Specifies that connections to the given TCP port or Unix socket on the local
362 (client) host are to be forwarded to the given host and port, or Unix socket,
364 This works by allocating a socket to listen to either a TCP
366 on the local side, optionally bound to the specified
369 Whenever a connection is made to the local port or socket, the
370 connection is forwarded over the secure channel, and a connection is
377 from the remote machine.
379 Port forwardings can also be specified in the configuration file.
380 Only the superuser can forward privileged ports.
381 IPv6 addresses can be specified by enclosing the address in square brackets.
383 By default, the local port is bound in accordance with the
388 may be used to bind the connection to a specific address.
393 indicates that the listening port be bound for local use only, while an
396 indicates that the port should be available from all interfaces.
398 .It Fl l Ar login_name
399 Specifies the user to log in as on the remote machine.
400 This also may be specified on a per-host basis in the configuration file.
407 mode for connection sharing.
414 mode but with confirmation required using
416 before each operation that changes the multiplexing state
417 (e.g. opening a new session).
418 Refer to the description of
425 A comma-separated list of MAC (message authentication code) algorithms,
426 specified in order of preference.
429 keyword for more information.
432 Do not execute a remote command.
433 This is useful for just forwarding ports.
434 Refer to the description of
443 (actually, prevents reading from stdin).
444 This must be used when
446 is run in the background.
447 A common trick is to use this to run X11 programs on a remote machine.
449 .Ic ssh -n shadows.cs.hut.fi emacs &
450 will start an emacs on shadows.cs.hut.fi, and the X11
451 connection will be automatically forwarded over an encrypted channel.
454 program will be put in the background.
455 (This does not work if
457 needs to ask for a password or passphrase; see also the
460 Refer to the description of
467 Control an active connection multiplexing master process.
470 option is specified, the
472 argument is interpreted and passed to the master process.
475 (check that the master process is running),
477 (request forwardings without command execution),
479 (cancel forwardings),
481 (request the master to exit), and
483 (request the master to stop accepting further multiplexing requests).
486 Can be used to give options in the format used in the configuration file.
487 This is useful for specifying options for which there is no separate
489 For full details of the options listed below, and their possible values, see
492 .Bl -tag -width Ds -offset indent -compact
498 .It CanonicalizeFallbackLocal
499 .It CanonicalizeHostname
500 .It CanonicalizeMaxDots
501 .It CanonicalizePermittedCNAMEs
502 .It CASignatureAlgorithms
506 .It ClearAllForwardings
508 .It ConnectionAttempts
515 .It ExitOnForwardFailure
517 .It ForkAfterAuthentication
520 .It ForwardX11Timeout
521 .It ForwardX11Trusted
523 .It GlobalKnownHostsFile
524 .It GSSAPIAuthentication
525 .It GSSAPIDelegateCredentials
528 .It HostbasedAcceptedAlgorithms
529 .It HostbasedAuthentication
530 .It HostKeyAlgorithms
537 .It KbdInteractiveAuthentication
538 .It KbdInteractiveDevices
540 .It KnownHostsCommand
546 .It NoHostAuthenticationForLocalhost
547 .It NumberOfPasswordPrompts
548 .It PasswordAuthentication
549 .It PermitLocalCommand
553 .It PreferredAuthentications
557 .It PubkeyAcceptedAlgorithms
558 .It PubkeyAuthentication
564 .It ServerAliveInterval
565 .It ServerAliveCountMax
569 .It StreamLocalBindMask
570 .It StreamLocalBindUnlink
571 .It StrictHostKeyChecking
577 .It UserKnownHostsFile
585 Port to connect to on the remote host.
586 This can be specified on a
587 per-host basis in the configuration file.
589 .It Fl Q Ar query_option
590 Queries for the algorithms supported by one of the following features:
592 (supported symmetric ciphers),
594 (supported symmetric ciphers that support authenticated encryption),
596 (supported query terms for use with the
600 (supported message integrity codes),
602 (key exchange algorithms),
606 (certificate key types),
608 (non-certificate key types),
610 (all key types and signature algorithms),
612 (supported SSH protocol versions), and
614 (supported signature algorithms).
615 Alternatively, any keyword from
619 that takes an algorithm list may be used as an alias for the corresponding
624 Causes most warning and diagnostic messages to be suppressed.
628 .Oo Ar bind_address : Oc
629 .Ar port : host : hostport
634 .Oo Ar bind_address : Oc
635 .Ar port : local_socket
640 .Ar remote_socket : host : hostport
645 .Ar remote_socket : local_socket
650 .Oo Ar bind_address : Oc
654 Specifies that connections to the given TCP port or Unix socket on the remote
655 (server) host are to be forwarded to the local side.
657 This works by allocating a socket to listen to either a TCP
659 or to a Unix socket on the remote side.
660 Whenever a connection is made to this port or Unix socket, the
661 connection is forwarded over the secure channel, and a connection
662 is made from the local machine to either an explicit destination specified by
668 or, if no explicit destination was specified,
670 will act as a SOCKS 4/5 proxy and forward connections to the destinations
671 requested by the remote SOCKS client.
673 Port forwardings can also be specified in the configuration file.
674 Privileged ports can be forwarded only when
675 logging in as root on the remote machine.
676 IPv6 addresses can be specified by enclosing the address in square brackets.
678 By default, TCP listening sockets on the server will be bound to the loopback
680 This may be overridden by specifying a
686 indicates that the remote socket should listen on all interfaces.
689 will only succeed if the server's
691 option is enabled (see
692 .Xr sshd_config 5 ) .
698 the listen port will be dynamically allocated on the server and reported
699 to the client at run time.
700 When used together with
702 the allocated port will be printed to the standard output.
705 Specifies the location of a control socket for connection sharing,
708 to disable connection sharing.
709 Refer to the description of
718 May be used to request invocation of a subsystem on the remote system.
719 Subsystems facilitate the use of SSH
720 as a secure transport for other applications (e.g.\&
722 The subsystem is specified as the remote command.
723 Refer to the description of
730 Disable pseudo-terminal allocation.
733 Force pseudo-terminal allocation.
734 This can be used to execute arbitrary
735 screen-based programs on a remote machine, which can be very useful,
736 e.g. when implementing menu services.
739 options force tty allocation, even if
744 Display the version number and exit.
750 to print debugging messages about its progress.
752 debugging connection, authentication, and configuration problems.
755 options increase the verbosity.
758 .It Fl W Ar host : Ns Ar port
759 Requests that standard input and output on the client be forwarded to
763 over the secure channel.
767 .Cm ExitOnForwardFailure
769 .Cm ClearAllForwardings ,
770 though these can be overridden in the configuration file or using
772 command line options.
775 .Ar local_tun Ns Op : Ns Ar remote_tun
779 device forwarding with the specified
781 devices between the client
786 The devices may be specified by numerical ID or the keyword
788 which uses the next available tunnel device.
791 is not specified, it defaults to
802 directive is unset, it will be set to the default tunnel mode, which is
806 forwarding mode it desired, then it should be specified before
810 Enables X11 forwarding.
811 This can also be specified on a per-host basis in a configuration file.
813 X11 forwarding should be enabled with caution.
814 Users with the ability to bypass file permissions on the remote host
815 (for the user's X authorization database)
816 can access the local X11 display through the forwarded connection.
817 An attacker may then be able to perform activities such as keystroke monitoring.
819 For this reason, X11 forwarding is subjected to X11 SECURITY extension
820 restrictions by default.
825 .Cm ForwardX11Trusted
828 for more information.
831 Disables X11 forwarding.
834 Enables trusted X11 forwarding.
835 Trusted X11 forwardings are not subjected to the X11 SECURITY extension
839 Send log information using the
842 By default this information is sent to stderr.
846 may additionally obtain configuration data from
847 a per-user configuration file and a system-wide configuration file.
848 The file format and configuration options are described in
851 The OpenSSH SSH client supports SSH protocol 2.
853 The methods available for authentication are:
854 GSSAPI-based authentication,
855 host-based authentication,
856 public key authentication,
857 keyboard-interactive authentication,
858 and password authentication.
859 Authentication methods are tried in the order specified above,
861 .Cm PreferredAuthentications
862 can be used to change the default order.
864 Host-based authentication works as follows:
865 If the machine the user logs in from is listed in
868 .Pa /etc/shosts.equiv
869 on the remote machine, the user is non-root and the user names are
870 the same on both sides, or if the files
874 exist in the user's home directory on the
875 remote machine and contain a line containing the name of the client
876 machine and the name of the user on that machine, the user is
877 considered for login.
878 Additionally, the server
880 be able to verify the client's
881 host key (see the description of
882 .Pa /etc/ssh/ssh_known_hosts
884 .Pa ~/.ssh/known_hosts ,
886 for login to be permitted.
887 This authentication method closes security holes due to IP
888 spoofing, DNS spoofing, and routing spoofing.
889 [Note to the administrator:
890 .Pa /etc/hosts.equiv ,
892 and the rlogin/rsh protocol in general, are inherently insecure and should be
893 disabled if security is desired.]
895 Public key authentication works as follows:
896 The scheme is based on public-key cryptography,
898 where encryption and decryption are done using separate keys,
899 and it is unfeasible to derive the decryption key from the encryption key.
900 The idea is that each user creates a public/private
901 key pair for authentication purposes.
902 The server knows the public key, and only the user knows the private key.
904 implements public key authentication protocol automatically,
905 using one of the DSA, ECDSA, Ed25519 or RSA algorithms.
906 The HISTORY section of
908 contains a brief discussion of the DSA and RSA algorithms.
911 .Pa ~/.ssh/authorized_keys
912 lists the public keys that are permitted for logging in.
913 When the user logs in, the
915 program tells the server which key pair it would like to use for
917 The client proves that it has access to the private key
918 and the server checks that the corresponding public key
919 is authorized to accept the account.
921 The server may inform the client of errors that prevented public key
922 authentication from succeeding after authentication completes using a
924 These may be viewed by increasing the
928 or higher (e.g. by using the
932 The user creates their key pair by running
934 This stores the private key in
939 .Pa ~/.ssh/id_ecdsa_sk
940 (authenticator-hosted ECDSA),
941 .Pa ~/.ssh/id_ed25519
943 .Pa ~/.ssh/id_ed25519_sk
944 (authenticator-hosted Ed25519),
948 and stores the public key in
949 .Pa ~/.ssh/id_dsa.pub
951 .Pa ~/.ssh/id_ecdsa.pub
953 .Pa ~/.ssh/id_ecdsa_sk.pub
954 (authenticator-hosted ECDSA),
955 .Pa ~/.ssh/id_ed25519.pub
957 .Pa ~/.ssh/id_ed25519_sk.pub
958 (authenticator-hosted Ed25519),
960 .Pa ~/.ssh/id_rsa.pub
962 in the user's home directory.
963 The user should then copy the public key
965 .Pa ~/.ssh/authorized_keys
966 in their home directory on the remote machine.
969 file corresponds to the conventional
971 file, and has one key
972 per line, though the lines can be very long.
973 After this, the user can log in without giving the password.
975 A variation on public key authentication
976 is available in the form of certificate authentication:
977 instead of a set of public/private keys,
978 signed certificates are used.
979 This has the advantage that a single trusted certification authority
980 can be used in place of many public/private keys.
981 See the CERTIFICATES section of
983 for more information.
985 The most convenient way to use public key or certificate authentication
986 may be with an authentication agent.
993 for more information.
995 Keyboard-interactive authentication works as follows:
996 The server sends an arbitrary
998 text and prompts for a response, possibly multiple times.
999 Examples of keyboard-interactive authentication include
1007 Finally, if other authentication methods fail,
1009 prompts the user for a password.
1010 The password is sent to the remote
1011 host for checking; however, since all communications are encrypted,
1012 the password cannot be seen by someone listening on the network.
1015 automatically maintains and checks a database containing
1016 identification for all hosts it has ever been used with.
1017 Host keys are stored in
1018 .Pa ~/.ssh/known_hosts
1019 in the user's home directory.
1020 Additionally, the file
1021 .Pa /etc/ssh/ssh_known_hosts
1022 is automatically checked for known hosts.
1023 Any new hosts are automatically added to the user's file.
1024 If a host's identification ever changes,
1026 warns about this and disables password authentication to prevent
1027 server spoofing or man-in-the-middle attacks,
1028 which could otherwise be used to circumvent the encryption.
1030 .Cm StrictHostKeyChecking
1031 option can be used to control logins to machines whose
1032 host key is not known or has changed.
1034 When the user's identity has been accepted by the server, the server
1035 either executes the given command in a non-interactive session or,
1036 if no command has been specified, logs into the machine and gives
1037 the user a normal shell as an interactive session.
1038 All communication with
1039 the remote command or shell will be automatically encrypted.
1041 If an interactive session is requested
1043 by default will only request a pseudo-terminal (pty) for interactive
1044 sessions when the client has one.
1049 can be used to override this behaviour.
1051 If a pseudo-terminal has been allocated the
1052 user may use the escape characters noted below.
1054 If no pseudo-terminal has been allocated,
1055 the session is transparent and can be used to reliably transfer binary data.
1056 On most systems, setting the escape character to
1058 will also make the session transparent even if a tty is used.
1060 The session terminates when the command or shell on the remote
1061 machine exits and all X11 and TCP connections have been closed.
1062 .Sh ESCAPE CHARACTERS
1063 When a pseudo-terminal has been requested,
1065 supports a number of functions through the use of an escape character.
1067 A single tilde character can be sent as
1069 or by following the tilde by a character other than those described below.
1070 The escape character must always follow a newline to be interpreted as
1072 The escape character can be changed in configuration files using the
1074 configuration directive or on the command line by the
1078 The supported escapes (assuming the default
1088 List forwarded connections.
1092 at logout when waiting for forwarded connection / X11 sessions to terminate.
1094 Display a list of escape characters.
1096 Send a BREAK to the remote system
1097 (only useful if the peer supports it).
1100 Currently this allows the addition of port forwardings using the
1105 options (see above).
1106 It also allows the cancellation of existing port-forwardings
1109 .Fl KL Oo Ar bind_address : Oc Ar port
1113 .Fl KR Oo Ar bind_address : Oc Ar port
1117 .Fl KD Oo Ar bind_address : Oc Ar port
1119 for dynamic port-forwardings.
1120 .Ic !\& Ns Ar command
1121 allows the user to execute a local command if the
1122 .Ic PermitLocalCommand
1123 option is enabled in
1125 Basic help is available, using the
1129 Request rekeying of the connection
1130 (only useful if the peer supports it).
1132 Decrease the verbosity
1134 when errors are being written to stderr.
1136 Increase the verbosity
1138 when errors are being written to stderr.
1141 Forwarding of arbitrary TCP connections over a secure channel
1142 can be specified either on the command line or in a configuration file.
1143 One possible application of TCP forwarding is a secure connection to a
1144 mail server; another is going through firewalls.
1146 In the example below, we look at encrypting communication for an IRC client,
1147 even though the IRC server it connects to does not directly
1148 support encrypted communication.
1149 This works as follows:
1150 the user connects to the remote host using
1152 specifying the ports to be used to forward the connection.
1153 After that it is possible to start the program locally,
1156 will encrypt and forward the connection to the remote server.
1158 The following example tunnels an IRC session from the client
1160 .Dq server.example.com ,
1165 using the standard IRC port, 6667:
1166 .Bd -literal -offset 4n
1167 $ ssh -f -L 6667:localhost:6667 server.example.com sleep 10
1168 $ irc -c '#users' pinky IRC/127.0.0.1
1175 and the remote command
1177 is specified to allow an amount of time
1178 (10 seconds, in the example)
1179 to start the program which is going to use the tunnel.
1180 If no connections are made within the time specified,
1188 (or see the description of the
1194 and the user is using X11 (the
1196 environment variable is set), the connection to the X11 display is
1197 automatically forwarded to the remote side in such a way that any X11
1198 programs started from the shell (or command) will go through the
1199 encrypted channel, and the connection to the real X server will be made
1200 from the local machine.
1201 The user should not manually set
1203 Forwarding of X11 connections can be
1204 configured on the command line or in configuration files.
1210 will point to the server machine, but with a display number greater than zero.
1211 This is normal, and happens because
1215 X server on the server machine for forwarding the
1216 connections over the encrypted channel.
1219 will also automatically set up Xauthority data on the server machine.
1220 For this purpose, it will generate a random authorization cookie,
1221 store it in Xauthority on the server, and verify that any forwarded
1222 connections carry this cookie and replace it by the real cookie when
1223 the connection is opened.
1224 The real authentication cookie is never
1225 sent to the server machine (and no cookies are sent in the plain).
1231 (or see the description of the
1236 the user is using an authentication agent, the connection to the agent
1237 is automatically forwarded to the remote side.
1238 .Sh VERIFYING HOST KEYS
1239 When connecting to a server for the first time,
1240 a fingerprint of the server's public key is presented to the user
1242 .Cm StrictHostKeyChecking
1244 Fingerprints can be determined using
1247 .Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1249 If the fingerprint is already known, it can be matched
1250 and the key can be accepted or rejected.
1251 If only legacy (MD5) fingerprints for the server are available, the
1254 option may be used to downgrade the fingerprint algorithm to match.
1256 Because of the difficulty of comparing host keys
1257 just by looking at fingerprint strings,
1258 there is also support to compare host keys visually,
1265 a small ASCII graphic gets displayed on every login to a server, no matter
1266 if the session itself is interactive or not.
1267 By learning the pattern a known server produces, a user can easily
1268 find out that the host key has changed when a completely different pattern
1270 Because these patterns are not unambiguous however, a pattern that looks
1271 similar to the pattern remembered only gives a good probability that the
1272 host key is the same, not guaranteed proof.
1274 To get a listing of the fingerprints along with their random art for
1275 all known hosts, the following command line can be used:
1277 .Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts
1279 If the fingerprint is unknown,
1280 an alternative method of verification is available:
1281 SSH fingerprints verified by DNS.
1282 An additional resource record (RR),
1284 is added to a zonefile
1285 and the connecting client is able to match the fingerprint
1286 with that of the key presented.
1288 In this example, we are connecting a client to a server,
1289 .Dq host.example.com .
1290 The SSHFP resource records should first be added to the zonefile for
1292 .Bd -literal -offset indent
1293 $ ssh-keygen -r host.example.com.
1296 The output lines will have to be added to the zonefile.
1297 To check that the zone is answering fingerprint queries:
1299 .Dl $ dig -t SSHFP host.example.com
1301 Finally the client connects:
1302 .Bd -literal -offset indent
1303 $ ssh -o "VerifyHostKeyDNS ask" host.example.com
1305 Matching host key fingerprint found in DNS.
1306 Are you sure you want to continue connecting (yes/no)?
1310 .Cm VerifyHostKeyDNS
1313 for more information.
1314 .Sh SSH-BASED VIRTUAL PRIVATE NETWORKS
1316 contains support for Virtual Private Network (VPN) tunnelling
1319 network pseudo-device,
1320 allowing two networks to be joined securely.
1323 configuration option
1325 controls whether the server supports this,
1326 and at what level (layer 2 or 3 traffic).
1328 The following example would connect client network 10.0.50.0/24
1329 with remote network 10.0.99.0/24 using a point-to-point connection
1330 from 10.1.1.1 to 10.1.1.2,
1331 provided that the SSH server running on the gateway to the remote network,
1332 at 192.168.1.15, allows it.
1335 .Bd -literal -offset indent
1336 # ssh -f -w 0:1 192.168.1.15 true
1337 # ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
1338 # route add 10.0.99.0/24 10.1.1.2
1342 .Bd -literal -offset indent
1343 # ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
1344 # route add 10.0.50.0/24 10.1.1.1
1347 Client access may be more finely tuned via the
1348 .Pa /root/.ssh/authorized_keys
1349 file (see below) and the
1352 The following entry would permit connections on
1356 and on tun device 2 from user
1361 .Dq forced-commands-only :
1362 .Bd -literal -offset 2n
1363 tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
1364 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
1367 Since an SSH-based setup entails a fair amount of overhead,
1368 it may be more suited to temporary setups,
1369 such as for wireless VPNs.
1370 More permanent VPNs are better provided by tools such as
1376 will normally set the following environment variables:
1377 .Bl -tag -width "SSH_ORIGINAL_COMMAND"
1381 variable indicates the location of the X11 server.
1382 It is automatically set by
1384 to point to a value of the form
1388 indicates the host where the shell runs, and
1390 is an integer \*(Ge 1.
1392 uses this special value to forward X11 connections over the secure
1394 The user should normally not set
1397 will render the X11 connection insecure (and will require the user to
1398 manually copy any required authorization cookies).
1400 Set to the path of the user's home directory.
1404 set for compatibility with systems that use this variable.
1406 Set to the path of the user's mailbox.
1410 as specified when compiling
1415 needs a passphrase, it will read the passphrase from the current
1416 terminal if it was run from a terminal.
1419 does not have a terminal associated with it but
1423 are set, it will execute the program specified by
1425 and open an X11 window to read the passphrase.
1426 This is particularly useful when calling
1431 (Note that on some machines it
1432 may be necessary to redirect the input from
1435 .It Ev SSH_ASKPASS_REQUIRE
1436 Allows further control over the use of an askpass program.
1437 If this variable is set to
1441 will never attempt to use one.
1446 will prefer to use the askpass program instead of the TTY when requesting
1448 Finally, if the variable is set to
1450 then the askpass program will be used for all passphrase input regardless
1454 .It Ev SSH_AUTH_SOCK
1455 Identifies the path of a
1457 socket used to communicate with the agent.
1458 .It Ev SSH_CONNECTION
1459 Identifies the client and server ends of the connection.
1460 The variable contains
1461 four space-separated values: client IP address, client port number,
1462 server IP address, and server port number.
1463 .It Ev SSH_ORIGINAL_COMMAND
1464 This variable contains the original command line if a forced command
1466 It can be used to extract the original arguments.
1468 This is set to the name of the tty (path to the device) associated
1469 with the current shell or command.
1470 If the current session has no tty,
1471 this variable is not set.
1475 to contain the interface names assigned if tunnel forwarding was
1476 requested by the client.
1477 .It Ev SSH_USER_AUTH
1480 this variable may contain a pathname to a file that lists the authentication
1481 methods successfully used when the session was established, including any
1482 public keys that were used.
1484 This variable is set to indicate the present time zone if it
1485 was set when the daemon was started (i.e. the daemon passes the value
1486 on to new connections).
1488 Set to the name of the user logging in.
1494 .Pa ~/.ssh/environment ,
1495 and adds lines of the format
1497 to the environment if the file exists and users are allowed to
1498 change their environment.
1499 For more information, see the
1500 .Cm PermitUserEnvironment
1504 .Bl -tag -width Ds -compact
1506 This file is used for host-based authentication (see above).
1507 On some machines this file may need to be
1508 world-readable if the user's home directory is on an NFS partition,
1512 Additionally, this file must be owned by the user,
1513 and must not have write permissions for anyone else.
1515 permission for most machines is read/write for the user, and not
1516 accessible by others.
1519 This file is used in exactly the same way as
1521 but allows host-based authentication without permitting login with
1525 This directory is the default location for all user-specific configuration
1526 and authentication information.
1527 There is no general requirement to keep the entire contents of this directory
1528 secret, but the recommended permissions are read/write/execute for the user,
1529 and not accessible by others.
1531 .It Pa ~/.ssh/authorized_keys
1532 Lists the public keys (DSA, ECDSA, Ed25519, RSA)
1533 that can be used for logging in as this user.
1534 The format of this file is described in the
1537 This file is not highly sensitive, but the recommended
1538 permissions are read/write for the user, and not accessible by others.
1540 .It Pa ~/.ssh/config
1541 This is the per-user configuration file.
1542 The file format and configuration options are described in
1544 Because of the potential for abuse, this file must have strict permissions:
1545 read/write for the user, and not writable by others.
1547 .It Pa ~/.ssh/environment
1548 Contains additional definitions for environment variables; see
1552 .It Pa ~/.ssh/id_dsa
1553 .It Pa ~/.ssh/id_ecdsa
1554 .It Pa ~/.ssh/id_ecdsa_sk
1555 .It Pa ~/.ssh/id_ed25519
1556 .It Pa ~/.ssh/id_ed25519_sk
1557 .It Pa ~/.ssh/id_rsa
1558 Contains the private key for authentication.
1560 contain sensitive data and should be readable by the user but not
1561 accessible by others (read/write/execute).
1563 will simply ignore a private key file if it is accessible by others.
1564 It is possible to specify a passphrase when
1565 generating the key which will be used to encrypt the
1566 sensitive part of this file using AES-128.
1568 .It Pa ~/.ssh/id_dsa.pub
1569 .It Pa ~/.ssh/id_ecdsa.pub
1570 .It Pa ~/.ssh/id_ecdsa_sk.pub
1571 .It Pa ~/.ssh/id_ed25519.pub
1572 .It Pa ~/.ssh/id_ed25519_sk.pub
1573 .It Pa ~/.ssh/id_rsa.pub
1574 Contains the public key for authentication.
1576 sensitive and can (but need not) be readable by anyone.
1578 .It Pa ~/.ssh/known_hosts
1579 Contains a list of host keys for all hosts the user has logged into
1580 that are not already in the systemwide list of known host keys.
1583 for further details of the format of this file.
1586 Commands in this file are executed by
1588 when the user logs in, just before the user's shell (or command) is
1592 manual page for more information.
1594 .It Pa /etc/hosts.equiv
1595 This file is for host-based authentication (see above).
1596 It should only be writable by root.
1598 .It Pa /etc/shosts.equiv
1599 This file is used in exactly the same way as
1601 but allows host-based authentication without permitting login with
1604 .It Pa /etc/ssh/ssh_config
1605 Systemwide configuration file.
1606 The file format and configuration options are described in
1609 .It Pa /etc/ssh/ssh_host_key
1610 .It Pa /etc/ssh/ssh_host_dsa_key
1611 .It Pa /etc/ssh/ssh_host_ecdsa_key
1612 .It Pa /etc/ssh/ssh_host_ed25519_key
1613 .It Pa /etc/ssh/ssh_host_rsa_key
1614 These files contain the private parts of the host keys
1615 and are used for host-based authentication.
1617 .It Pa /etc/ssh/ssh_known_hosts
1618 Systemwide list of known host keys.
1619 This file should be prepared by the
1620 system administrator to contain the public host keys of all machines in the
1622 It should be world-readable.
1625 for further details of the format of this file.
1627 .It Pa /etc/ssh/sshrc
1628 Commands in this file are executed by
1630 when the user logs in, just before the user's shell (or command) is started.
1633 manual page for more information.
1637 exits with the exit status of the remote command or with 255
1638 if an error occurred.
1656 .%T The Secure Shell (SSH) Protocol Assigned Numbers
1664 .%T The Secure Shell (SSH) Protocol Architecture
1672 .%T The Secure Shell (SSH) Authentication Protocol
1680 .%T The Secure Shell (SSH) Transport Layer Protocol
1688 .%T The Secure Shell (SSH) Connection Protocol
1696 .%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
1704 .%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
1712 .%T The Secure Shell (SSH) Session Channel Break Extension
1721 .%T The Secure Shell (SSH) Transport Layer Encryption Modes
1728 .%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol
1737 .%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
1745 .%T The Secure Shell (SSH) Public Key File Format
1753 .%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
1760 .%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)
1761 .%T Hash Visualization: a New Technique to improve Real-World Security
1764 OpenSSH is a derivative of the original and free
1765 ssh 1.2.12 release by Tatu Ylonen.
1766 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1767 Theo de Raadt and Dug Song
1768 removed many bugs, re-added newer features and
1770 Markus Friedl contributed the support for SSH
1771 protocol versions 1.5 and 2.0.