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.384 2017/09/21 19:16:53 markus Exp $
37 .Dd $Mdocdate: September 21 2017 $
42 .Nd OpenSSH SSH client (remote login program)
46 .Op Fl 46AaCfGgKkMNnqsTtVvXxYy
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 Oo Ar user Ns @ Oc Ns Ar host Ns Op : Ns Ar port
57 .Op Fl l Ar login_name
62 .Op Fl Q Ar query_option
65 .Op Fl W Ar host : Ns Ar port
66 .Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun
67 .Oo Ar user Ns @ Oc Ns Ar hostname
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
87 his/her identity to the remote machine using one of several methods
93 it is executed on the remote host instead of a login shell.
95 The options are as follows:
97 .Bl -tag -width Ds -compact
101 to use IPv4 addresses only.
106 to use IPv6 addresses only.
109 Enables forwarding of the authentication agent connection.
110 This can also be specified on a per-host basis in a configuration file.
112 Agent forwarding should be enabled with caution.
113 Users with the ability to bypass file permissions on the remote host
116 socket) can access the local agent through the forwarded connection.
117 An attacker cannot obtain key material from the agent,
118 however they can perform operations on the keys that enable them to
119 authenticate using the identities loaded into the agent.
122 Disables forwarding of the authentication agent connection.
124 .It Fl b Ar bind_address
127 on the local machine as the source address
129 Only useful on systems with more than one address.
132 Requests compression of all data (including stdin, stdout, stderr, and
133 data for forwarded X11, TCP and
136 The compression algorithm is the same used by
138 Compression is desirable on modem lines and other
139 slow connections, but will only slow down things on fast networks.
140 The default value can be set on a host-by-host basis in the
141 configuration files; see the
145 .It Fl c Ar cipher_spec
146 Selects the cipher specification for encrypting the session.
148 is a comma-separated list of ciphers
149 listed in order of preference.
154 for more information.
158 .Oo Ar bind_address : Oc
164 application-level port forwarding.
165 This works by allocating a socket to listen to
167 on the local side, optionally bound to the specified
169 Whenever a connection is made to this port, the
170 connection is forwarded over the secure channel, and the application
171 protocol is then used to determine where to connect to from the
173 Currently the SOCKS4 and SOCKS5 protocols are supported, and
175 will act as a SOCKS server.
176 Only root can forward privileged ports.
177 Dynamic port forwardings can also be specified in the configuration file.
179 IPv6 addresses can be specified by enclosing the address in square brackets.
180 Only the superuser can forward privileged ports.
181 By default, the local port is bound in accordance with the
186 may be used to bind the connection to a specific address.
191 indicates that the listening port be bound for local use only, while an
194 indicates that the port should be available from all interfaces.
199 instead of standard error.
201 .It Fl e Ar escape_char
202 Sets the escape character for sessions with a pty (default:
204 The escape character is only recognized at the beginning of a line.
205 The escape character followed by a dot
207 closes the connection;
208 followed by control-Z suspends the connection;
209 and followed by itself sends the escape character once.
210 Setting the character to
212 disables any escapes and makes the session fully transparent.
214 .It Fl F Ar configfile
215 Specifies an alternative per-user configuration file.
216 If a configuration file is given on the command line,
217 the system-wide configuration file
218 .Pq Pa /etc/ssh/ssh_config
220 The default for the per-user configuration file is
226 to go to background just before command execution.
229 is going to ask for passwords or passphrases, but the user
230 wants it in the background.
233 The recommended way to start X11 programs at a remote site is with
235 .Ic ssh -f host xterm .
238 .Cm ExitOnForwardFailure
239 configuration option is set to
241 then a client started with
243 will wait for all remote port forwards to be successfully established
244 before placing itself in the background.
249 to print its configuration after evaluating
256 Allows remote hosts to connect to local forwarded ports.
257 If used on a multiplexed connection, then this option must be specified
258 on the master process.
261 Specify the PKCS#11 shared library
263 should use to communicate with a PKCS#11 token providing the user's
266 .It Fl i Ar identity_file
267 Selects a file from which the identity (private key) for
268 public key authentication is read.
271 .Pa ~/.ssh/id_ecdsa ,
272 .Pa ~/.ssh/id_ed25519
275 Identity files may also be specified on
276 a per-host basis in the configuration file.
277 It is possible to have multiple
279 options (and multiple identities specified in
280 configuration files).
281 If no certificates have been explicitly specified by the
285 will also try to load certificate information from the filename obtained
288 to identity filenames.
297 Connect to the target host by first making a
299 connection to the jump
301 and then establishing a TCP forwarding to the ultimate destination from
303 Multiple jump hops may be specified separated by comma characters.
304 This is a shortcut to specify a
306 configuration directive.
309 Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
310 credentials to the server.
313 Disables forwarding (delegation) of GSSAPI credentials to the server.
317 .Oo Ar bind_address : Oc
318 .Ar port : host : hostport
323 .Oo Ar bind_address : Oc
324 .Ar port : remote_socket
329 .Ar local_socket : host : hostport
334 .Ar local_socket : remote_socket
337 Specifies that connections to the given TCP port or Unix socket on the local
338 (client) host are to be forwarded to the given host and port, or Unix socket,
340 This works by allocating a socket to listen to either a TCP
342 on the local side, optionally bound to the specified
345 Whenever a connection is made to the local port or socket, the
346 connection is forwarded over the secure channel, and a connection is
353 from the remote machine.
355 Port forwardings can also be specified in the configuration file.
356 Only the superuser can forward privileged ports.
357 IPv6 addresses can be specified by enclosing the address in square brackets.
359 By default, the local port is bound in accordance with the
364 may be used to bind the connection to a specific address.
369 indicates that the listening port be bound for local use only, while an
372 indicates that the port should be available from all interfaces.
374 .It Fl l Ar login_name
375 Specifies the user to log in as on the remote machine.
376 This also may be specified on a per-host basis in the configuration file.
383 mode for connection sharing.
390 mode with confirmation required before slave connections are accepted.
391 Refer to the description of
398 A comma-separated list of MAC (message authentication code) algorithms,
399 specified in order of preference.
402 keyword for more information.
405 Do not execute a remote command.
406 This is useful for just forwarding ports.
411 (actually, prevents reading from stdin).
412 This must be used when
414 is run in the background.
415 A common trick is to use this to run X11 programs on a remote machine.
417 .Ic ssh -n shadows.cs.hut.fi emacs &
418 will start an emacs on shadows.cs.hut.fi, and the X11
419 connection will be automatically forwarded over an encrypted channel.
422 program will be put in the background.
423 (This does not work if
425 needs to ask for a password or passphrase; see also the
430 Control an active connection multiplexing master process.
433 option is specified, the
435 argument is interpreted and passed to the master process.
438 (check that the master process is running),
440 (request forwardings without command execution),
442 (cancel forwardings),
444 (request the master to exit), and
446 (request the master to stop accepting further multiplexing requests).
449 Can be used to give options in the format used in the configuration file.
450 This is useful for specifying options for which there is no separate
452 For full details of the options listed below, and their possible values, see
455 .Bl -tag -width Ds -offset indent -compact
461 .It CanonicalizeFallbackLocal
462 .It CanonicalizeHostname
463 .It CanonicalizeMaxDots
464 .It CanonicalizePermittedCNAMEs
466 .It ChallengeResponseAuthentication
469 .It ClearAllForwardings
471 .It ConnectionAttempts
478 .It ExitOnForwardFailure
482 .It ForwardX11Timeout
483 .It ForwardX11Trusted
485 .It GlobalKnownHostsFile
486 .It GSSAPIAuthentication
487 .It GSSAPIDelegateCredentials
490 .It HostbasedAuthentication
491 .It HostbasedKeyTypes
492 .It HostKeyAlgorithms
500 .It KbdInteractiveAuthentication
501 .It KbdInteractiveDevices
508 .It NoHostAuthenticationForLocalhost
509 .It NumberOfPasswordPrompts
510 .It PasswordAuthentication
511 .It PermitLocalCommand
514 .It PreferredAuthentications
518 .It PubkeyAcceptedKeyTypes
519 .It PubkeyAuthentication
525 .It ServerAliveInterval
526 .It ServerAliveCountMax
527 .It StreamLocalBindMask
528 .It StreamLocalBindUnlink
529 .It StrictHostKeyChecking
534 .It UsePrivilegedPort
536 .It UserKnownHostsFile
543 Port to connect to on the remote host.
544 This can be specified on a
545 per-host basis in the configuration file.
547 .It Fl Q Ar query_option
550 for the algorithms supported for the specified version 2.
551 The available features are:
553 (supported symmetric ciphers),
555 (supported symmetric ciphers that support authenticated encryption),
557 (supported message integrity codes),
559 (key exchange algorithms),
563 (certificate key types),
565 (non-certificate key types), and
567 (supported SSH protocol versions).
571 Causes most warning and diagnostic messages to be suppressed.
575 .Oo Ar bind_address : Oc
576 .Ar port : host : hostport
581 .Oo Ar bind_address : Oc
582 .Ar port : local_socket
587 .Ar remote_socket : host : hostport
592 .Ar remote_socket : local_socket
597 .Oo Ar bind_address : Oc
601 Specifies that connections to the given TCP port or Unix socket on the remote
602 (server) host are to be forwarded to the local side.
604 This works by allocating a socket to listen to either a TCP
606 or to a Unix socket on the remote side.
607 Whenever a connection is made to this port or Unix socket, the
608 connection is forwarded over the secure channel, and a connection
609 is made from the local machine to either an explicit destination specified by
615 or, if no explicit destination was specified,
617 will act as a SOCKS 4/5 proxy and forward connections to the destinations
618 requested by the remote SOCKS client.
620 Port forwardings can also be specified in the configuration file.
621 Privileged ports can be forwarded only when
622 logging in as root on the remote machine.
623 IPv6 addresses can be specified by enclosing the address in square brackets.
625 By default, TCP listening sockets on the server will be bound to the loopback
627 This may be overridden by specifying a
633 indicates that the remote socket should listen on all interfaces.
636 will only succeed if the server's
638 option is enabled (see
639 .Xr sshd_config 5 ) .
645 the listen port will be dynamically allocated on the server and reported
646 to the client at run time.
647 When used together with
649 the allocated port will be printed to the standard output.
652 Specifies the location of a control socket for connection sharing,
655 to disable connection sharing.
656 Refer to the description of
665 May be used to request invocation of a subsystem on the remote system.
666 Subsystems facilitate the use of SSH
667 as a secure transport for other applications (e.g.\&
669 The subsystem is specified as the remote command.
672 Disable pseudo-terminal allocation.
675 Force pseudo-terminal allocation.
676 This can be used to execute arbitrary
677 screen-based programs on a remote machine, which can be very useful,
678 e.g. when implementing menu services.
681 options force tty allocation, even if
686 Display the version number and exit.
692 to print debugging messages about its progress.
694 debugging connection, authentication, and configuration problems.
697 options increase the verbosity.
700 .It Fl W Ar host : Ns Ar port
701 Requests that standard input and output on the client be forwarded to
705 over the secure channel.
709 .Cm ExitOnForwardFailure
711 .Cm ClearAllForwardings ,
712 though these can be overridden in the configuration file or using
714 command line options.
717 .Ar local_tun Ns Op : Ns Ar remote_tun
721 device forwarding with the specified
723 devices between the client
728 The devices may be specified by numerical ID or the keyword
730 which uses the next available tunnel device.
733 is not specified, it defaults to
743 directive is unset, it is set to the default tunnel mode, which is
747 Enables X11 forwarding.
748 This can also be specified on a per-host basis in a configuration file.
750 X11 forwarding should be enabled with caution.
751 Users with the ability to bypass file permissions on the remote host
752 (for the user's X authorization database)
753 can access the local X11 display through the forwarded connection.
754 An attacker may then be able to perform activities such as keystroke monitoring.
756 For this reason, X11 forwarding is subjected to X11 SECURITY extension
757 restrictions by default.
762 .Cm ForwardX11Trusted
765 for more information.
768 Disables X11 forwarding.
771 Enables trusted X11 forwarding.
772 Trusted X11 forwardings are not subjected to the X11 SECURITY extension
776 Send log information using the
779 By default this information is sent to stderr.
783 may additionally obtain configuration data from
784 a per-user configuration file and a system-wide configuration file.
785 The file format and configuration options are described in
788 The OpenSSH SSH client supports SSH protocol 2.
790 The methods available for authentication are:
791 GSSAPI-based authentication,
792 host-based authentication,
793 public key authentication,
794 challenge-response authentication,
795 and password authentication.
796 Authentication methods are tried in the order specified above,
798 .Cm PreferredAuthentications
799 can be used to change the default order.
801 Host-based authentication works as follows:
802 If the machine the user logs in from is listed in
805 .Pa /etc/shosts.equiv
806 on the remote machine, and the user names are
807 the same on both sides, or if the files
811 exist in the user's home directory on the
812 remote machine and contain a line containing the name of the client
813 machine and the name of the user on that machine, the user is
814 considered for login.
815 Additionally, the server
817 be able to verify the client's
818 host key (see the description of
819 .Pa /etc/ssh/ssh_known_hosts
821 .Pa ~/.ssh/known_hosts ,
823 for login to be permitted.
824 This authentication method closes security holes due to IP
825 spoofing, DNS spoofing, and routing spoofing.
826 [Note to the administrator:
827 .Pa /etc/hosts.equiv ,
829 and the rlogin/rsh protocol in general, are inherently insecure and should be
830 disabled if security is desired.]
832 Public key authentication works as follows:
833 The scheme is based on public-key cryptography,
835 where encryption and decryption are done using separate keys,
836 and it is unfeasible to derive the decryption key from the encryption key.
837 The idea is that each user creates a public/private
838 key pair for authentication purposes.
839 The server knows the public key, and only the user knows the private key.
841 implements public key authentication protocol automatically,
842 using one of the DSA, ECDSA, Ed25519 or RSA algorithms.
843 The HISTORY section of
845 contains a brief discussion of the DSA and RSA algorithms.
848 .Pa ~/.ssh/authorized_keys
849 lists the public keys that are permitted for logging in.
850 When the user logs in, the
852 program tells the server which key pair it would like to use for
854 The client proves that it has access to the private key
855 and the server checks that the corresponding public key
856 is authorized to accept the account.
858 The server may inform the client of errors that prevented public key
859 authentication from succeeding after authentication completes using a
861 These may be viewed by increasing the
865 or higher (e.g. by using the
869 The user creates his/her key pair by running
871 This stores the private key in
876 .Pa ~/.ssh/id_ed25519
881 and stores the public key in
882 .Pa ~/.ssh/id_dsa.pub
884 .Pa ~/.ssh/id_ecdsa.pub
886 .Pa ~/.ssh/id_ed25519.pub
889 .Pa ~/.ssh/id_rsa.pub
891 in the user's home directory.
892 The user should then copy the public key
894 .Pa ~/.ssh/authorized_keys
895 in his/her home directory on the remote machine.
898 file corresponds to the conventional
900 file, and has one key
901 per line, though the lines can be very long.
902 After this, the user can log in without giving the password.
904 A variation on public key authentication
905 is available in the form of certificate authentication:
906 instead of a set of public/private keys,
907 signed certificates are used.
908 This has the advantage that a single trusted certification authority
909 can be used in place of many public/private keys.
910 See the CERTIFICATES section of
912 for more information.
914 The most convenient way to use public key or certificate authentication
915 may be with an authentication agent.
922 for more information.
924 Challenge-response authentication works as follows:
925 The server sends an arbitrary
927 text, and prompts for a response.
928 Examples of challenge-response authentication include
936 Finally, if other authentication methods fail,
938 prompts the user for a password.
939 The password is sent to the remote
940 host for checking; however, since all communications are encrypted,
941 the password cannot be seen by someone listening on the network.
944 automatically maintains and checks a database containing
945 identification for all hosts it has ever been used with.
946 Host keys are stored in
947 .Pa ~/.ssh/known_hosts
948 in the user's home directory.
949 Additionally, the file
950 .Pa /etc/ssh/ssh_known_hosts
951 is automatically checked for known hosts.
952 Any new hosts are automatically added to the user's file.
953 If a host's identification ever changes,
955 warns about this and disables password authentication to prevent
956 server spoofing or man-in-the-middle attacks,
957 which could otherwise be used to circumvent the encryption.
959 .Cm StrictHostKeyChecking
960 option can be used to control logins to machines whose
961 host key is not known or has changed.
963 When the user's identity has been accepted by the server, the server
964 either executes the given command in a non-interactive session or,
965 if no command has been specified, logs into the machine and gives
966 the user a normal shell as an interactive session.
967 All communication with
968 the remote command or shell will be automatically encrypted.
970 If an interactive session is requested
972 by default will only request a pseudo-terminal (pty) for interactive
973 sessions when the client has one.
978 can be used to override this behaviour.
980 If a pseudo-terminal has been allocated the
981 user may use the escape characters noted below.
983 If no pseudo-terminal has been allocated,
984 the session is transparent and can be used to reliably transfer binary data.
985 On most systems, setting the escape character to
987 will also make the session transparent even if a tty is used.
989 The session terminates when the command or shell on the remote
990 machine exits and all X11 and TCP connections have been closed.
991 .Sh ESCAPE CHARACTERS
992 When a pseudo-terminal has been requested,
994 supports a number of functions through the use of an escape character.
996 A single tilde character can be sent as
998 or by following the tilde by a character other than those described below.
999 The escape character must always follow a newline to be interpreted as
1001 The escape character can be changed in configuration files using the
1003 configuration directive or on the command line by the
1007 The supported escapes (assuming the default
1017 List forwarded connections.
1021 at logout when waiting for forwarded connection / X11 sessions to terminate.
1023 Display a list of escape characters.
1025 Send a BREAK to the remote system
1026 (only useful if the peer supports it).
1029 Currently this allows the addition of port forwardings using the
1034 options (see above).
1035 It also allows the cancellation of existing port-forwardings
1038 .Fl KL Oo Ar bind_address : Oc Ar port
1042 .Fl KR Oo Ar bind_address : Oc Ar port
1046 .Fl KD Oo Ar bind_address : Oc Ar port
1048 for dynamic port-forwardings.
1049 .Ic !\& Ns Ar command
1050 allows the user to execute a local command if the
1051 .Ic PermitLocalCommand
1052 option is enabled in
1054 Basic help is available, using the
1058 Request rekeying of the connection
1059 (only useful if the peer supports it).
1061 Decrease the verbosity
1063 when errors are being written to stderr.
1065 Increase the verbosity
1067 when errors are being written to stderr.
1070 Forwarding of arbitrary TCP connections over the secure channel can
1071 be specified either on the command line or in a configuration file.
1072 One possible application of TCP forwarding is a secure connection to a
1073 mail server; another is going through firewalls.
1075 In the example below, we look at encrypting communication between
1076 an IRC client and server, even though the IRC server does not directly
1077 support encrypted communications.
1078 This works as follows:
1079 the user connects to the remote host using
1081 specifying a port to be used to forward connections
1082 to the remote server.
1083 After that it is possible to start the service which is to be encrypted
1084 on the client machine,
1085 connecting to the same local port,
1088 will encrypt and forward the connection.
1090 The following example tunnels an IRC session from client machine
1094 .Dq server.example.com :
1095 .Bd -literal -offset 4n
1096 $ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
1097 $ irc -c '#users' -p 1234 pinky 127.0.0.1
1100 This tunnels a connection to IRC server
1101 .Dq server.example.com ,
1107 It doesn't matter which port is used,
1108 as long as it's greater than 1023
1109 (remember, only root can open sockets on privileged ports)
1110 and doesn't conflict with any ports already in use.
1111 The connection is forwarded to port 6667 on the remote server,
1112 since that's the standard port for IRC services.
1118 and the remote command
1120 is specified to allow an amount of time
1121 (10 seconds, in the example)
1122 to start the service which is to be tunnelled.
1123 If no connections are made within the time specified,
1131 (or see the description of the
1137 and the user is using X11 (the
1139 environment variable is set), the connection to the X11 display is
1140 automatically forwarded to the remote side in such a way that any X11
1141 programs started from the shell (or command) will go through the
1142 encrypted channel, and the connection to the real X server will be made
1143 from the local machine.
1144 The user should not manually set
1146 Forwarding of X11 connections can be
1147 configured on the command line or in configuration files.
1153 will point to the server machine, but with a display number greater than zero.
1154 This is normal, and happens because
1158 X server on the server machine for forwarding the
1159 connections over the encrypted channel.
1162 will also automatically set up Xauthority data on the server machine.
1163 For this purpose, it will generate a random authorization cookie,
1164 store it in Xauthority on the server, and verify that any forwarded
1165 connections carry this cookie and replace it by the real cookie when
1166 the connection is opened.
1167 The real authentication cookie is never
1168 sent to the server machine (and no cookies are sent in the plain).
1174 (or see the description of the
1179 the user is using an authentication agent, the connection to the agent
1180 is automatically forwarded to the remote side.
1181 .Sh VERIFYING HOST KEYS
1182 When connecting to a server for the first time,
1183 a fingerprint of the server's public key is presented to the user
1185 .Cm StrictHostKeyChecking
1187 Fingerprints can be determined using
1190 .Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1192 If the fingerprint is already known, it can be matched
1193 and the key can be accepted or rejected.
1194 If only legacy (MD5) fingerprints for the server are available, the
1197 option may be used to downgrade the fingerprint algorithm to match.
1199 Because of the difficulty of comparing host keys
1200 just by looking at fingerprint strings,
1201 there is also support to compare host keys visually,
1208 a small ASCII graphic gets displayed on every login to a server, no matter
1209 if the session itself is interactive or not.
1210 By learning the pattern a known server produces, a user can easily
1211 find out that the host key has changed when a completely different pattern
1213 Because these patterns are not unambiguous however, a pattern that looks
1214 similar to the pattern remembered only gives a good probability that the
1215 host key is the same, not guaranteed proof.
1217 To get a listing of the fingerprints along with their random art for
1218 all known hosts, the following command line can be used:
1220 .Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts
1222 If the fingerprint is unknown,
1223 an alternative method of verification is available:
1224 SSH fingerprints verified by DNS.
1225 An additional resource record (RR),
1227 is added to a zonefile
1228 and the connecting client is able to match the fingerprint
1229 with that of the key presented.
1231 In this example, we are connecting a client to a server,
1232 .Dq host.example.com .
1233 The SSHFP resource records should first be added to the zonefile for
1235 .Bd -literal -offset indent
1236 $ ssh-keygen -r host.example.com.
1239 The output lines will have to be added to the zonefile.
1240 To check that the zone is answering fingerprint queries:
1242 .Dl $ dig -t SSHFP host.example.com
1244 Finally the client connects:
1245 .Bd -literal -offset indent
1246 $ ssh -o "VerifyHostKeyDNS ask" host.example.com
1248 Matching host key fingerprint found in DNS.
1249 Are you sure you want to continue connecting (yes/no)?
1253 .Cm VerifyHostKeyDNS
1256 for more information.
1257 .Sh SSH-BASED VIRTUAL PRIVATE NETWORKS
1259 contains support for Virtual Private Network (VPN) tunnelling
1262 network pseudo-device,
1263 allowing two networks to be joined securely.
1266 configuration option
1268 controls whether the server supports this,
1269 and at what level (layer 2 or 3 traffic).
1271 The following example would connect client network 10.0.50.0/24
1272 with remote network 10.0.99.0/24 using a point-to-point connection
1273 from 10.1.1.1 to 10.1.1.2,
1274 provided that the SSH server running on the gateway to the remote network,
1275 at 192.168.1.15, allows it.
1278 .Bd -literal -offset indent
1279 # ssh -f -w 0:1 192.168.1.15 true
1280 # ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
1281 # route add 10.0.99.0/24 10.1.1.2
1285 .Bd -literal -offset indent
1286 # ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
1287 # route add 10.0.50.0/24 10.1.1.1
1290 Client access may be more finely tuned via the
1291 .Pa /root/.ssh/authorized_keys
1292 file (see below) and the
1295 The following entry would permit connections on
1299 and on tun device 2 from user
1304 .Dq forced-commands-only :
1305 .Bd -literal -offset 2n
1306 tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
1307 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
1310 Since an SSH-based setup entails a fair amount of overhead,
1311 it may be more suited to temporary setups,
1312 such as for wireless VPNs.
1313 More permanent VPNs are better provided by tools such as
1319 will normally set the following environment variables:
1320 .Bl -tag -width "SSH_ORIGINAL_COMMAND"
1324 variable indicates the location of the X11 server.
1325 It is automatically set by
1327 to point to a value of the form
1331 indicates the host where the shell runs, and
1333 is an integer \*(Ge 1.
1335 uses this special value to forward X11 connections over the secure
1337 The user should normally not set
1340 will render the X11 connection insecure (and will require the user to
1341 manually copy any required authorization cookies).
1343 Set to the path of the user's home directory.
1347 set for compatibility with systems that use this variable.
1349 Set to the path of the user's mailbox.
1353 as specified when compiling
1358 needs a passphrase, it will read the passphrase from the current
1359 terminal if it was run from a terminal.
1362 does not have a terminal associated with it but
1366 are set, it will execute the program specified by
1368 and open an X11 window to read the passphrase.
1369 This is particularly useful when calling
1374 (Note that on some machines it
1375 may be necessary to redirect the input from
1378 .It Ev SSH_AUTH_SOCK
1379 Identifies the path of a
1381 socket used to communicate with the agent.
1382 .It Ev SSH_CONNECTION
1383 Identifies the client and server ends of the connection.
1384 The variable contains
1385 four space-separated values: client IP address, client port number,
1386 server IP address, and server port number.
1387 .It Ev SSH_ORIGINAL_COMMAND
1388 This variable contains the original command line if a forced command
1390 It can be used to extract the original arguments.
1392 This is set to the name of the tty (path to the device) associated
1393 with the current shell or command.
1394 If the current session has no tty,
1395 this variable is not set.
1397 This variable is set to indicate the present time zone if it
1398 was set when the daemon was started (i.e. the daemon passes the value
1399 on to new connections).
1401 Set to the name of the user logging in.
1407 .Pa ~/.ssh/environment ,
1408 and adds lines of the format
1410 to the environment if the file exists and users are allowed to
1411 change their environment.
1412 For more information, see the
1413 .Cm PermitUserEnvironment
1417 .Bl -tag -width Ds -compact
1419 This file is used for host-based authentication (see above).
1420 On some machines this file may need to be
1421 world-readable if the user's home directory is on an NFS partition,
1425 Additionally, this file must be owned by the user,
1426 and must not have write permissions for anyone else.
1428 permission for most machines is read/write for the user, and not
1429 accessible by others.
1432 This file is used in exactly the same way as
1434 but allows host-based authentication without permitting login with
1438 This directory is the default location for all user-specific configuration
1439 and authentication information.
1440 There is no general requirement to keep the entire contents of this directory
1441 secret, but the recommended permissions are read/write/execute for the user,
1442 and not accessible by others.
1444 .It Pa ~/.ssh/authorized_keys
1445 Lists the public keys (DSA, ECDSA, Ed25519, RSA)
1446 that can be used for logging in as this user.
1447 The format of this file is described in the
1450 This file is not highly sensitive, but the recommended
1451 permissions are read/write for the user, and not accessible by others.
1453 .It Pa ~/.ssh/config
1454 This is the per-user configuration file.
1455 The file format and configuration options are described in
1457 Because of the potential for abuse, this file must have strict permissions:
1458 read/write for the user, and not writable by others.
1460 .It Pa ~/.ssh/environment
1461 Contains additional definitions for environment variables; see
1465 .It Pa ~/.ssh/id_dsa
1466 .It Pa ~/.ssh/id_ecdsa
1467 .It Pa ~/.ssh/id_ed25519
1468 .It Pa ~/.ssh/id_rsa
1469 Contains the private key for authentication.
1471 contain sensitive data and should be readable by the user but not
1472 accessible by others (read/write/execute).
1474 will simply ignore a private key file if it is accessible by others.
1475 It is possible to specify a passphrase when
1476 generating the key which will be used to encrypt the
1477 sensitive part of this file using 3DES.
1479 .It Pa ~/.ssh/id_dsa.pub
1480 .It Pa ~/.ssh/id_ecdsa.pub
1481 .It Pa ~/.ssh/id_ed25519.pub
1482 .It Pa ~/.ssh/id_rsa.pub
1483 Contains the public key for authentication.
1485 sensitive and can (but need not) be readable by anyone.
1487 .It Pa ~/.ssh/known_hosts
1488 Contains a list of host keys for all hosts the user has logged into
1489 that are not already in the systemwide list of known host keys.
1492 for further details of the format of this file.
1495 Commands in this file are executed by
1497 when the user logs in, just before the user's shell (or command) is
1501 manual page for more information.
1503 .It Pa /etc/hosts.equiv
1504 This file is for host-based authentication (see above).
1505 It should only be writable by root.
1507 .It Pa /etc/shosts.equiv
1508 This file is used in exactly the same way as
1510 but allows host-based authentication without permitting login with
1513 .It Pa /etc/ssh/ssh_config
1514 Systemwide configuration file.
1515 The file format and configuration options are described in
1518 .It Pa /etc/ssh/ssh_host_key
1519 .It Pa /etc/ssh/ssh_host_dsa_key
1520 .It Pa /etc/ssh/ssh_host_ecdsa_key
1521 .It Pa /etc/ssh/ssh_host_ed25519_key
1522 .It Pa /etc/ssh/ssh_host_rsa_key
1523 These files contain the private parts of the host keys
1524 and are used for host-based authentication.
1526 .It Pa /etc/ssh/ssh_known_hosts
1527 Systemwide list of known host keys.
1528 This file should be prepared by the
1529 system administrator to contain the public host keys of all machines in the
1531 It should be world-readable.
1534 for further details of the format of this file.
1536 .It Pa /etc/ssh/sshrc
1537 Commands in this file are executed by
1539 when the user logs in, just before the user's shell (or command) is started.
1542 manual page for more information.
1546 exits with the exit status of the remote command or with 255
1547 if an error occurred.
1565 .%T The Secure Shell (SSH) Protocol Assigned Numbers
1573 .%T The Secure Shell (SSH) Protocol Architecture
1581 .%T The Secure Shell (SSH) Authentication Protocol
1589 .%T The Secure Shell (SSH) Transport Layer Protocol
1597 .%T The Secure Shell (SSH) Connection Protocol
1605 .%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
1613 .%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
1621 .%T The Secure Shell (SSH) Session Channel Break Extension
1630 .%T The Secure Shell (SSH) Transport Layer Encryption Modes
1637 .%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol
1646 .%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
1654 .%T The Secure Shell (SSH) Public Key File Format
1662 .%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
1669 .%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)
1670 .%T Hash Visualization: a New Technique to improve Real-World Security
1673 OpenSSH is a derivative of the original and free
1674 ssh 1.2.12 release by Tatu Ylonen.
1675 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1676 Theo de Raadt and Dug Song
1677 removed many bugs, re-added newer features and
1679 Markus Friedl contributed the support for SSH
1680 protocol versions 1.5 and 2.0.