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.356 2015/03/03 06:48:58 djm Exp $
37 .Dd $Mdocdate: March 3 2015 $
42 .Nd OpenSSH SSH client (remote login program)
46 .Op Fl 1246AaCfGgKkMNnqsTtVvXxYy
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 L Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport
56 .Op Fl l Ar login_name
61 .Op Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version
62 .Op Fl R Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport
64 .Op Fl W Ar host : Ns Ar port
65 .Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun
66 .Oo Ar user Ns @ Oc Ns Ar hostname
71 (SSH client) is a program for logging into a remote machine and for
72 executing commands on a remote machine.
73 It is intended to replace rlogin and rsh,
74 and 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
88 depending on the protocol version used (see below).
93 it is executed on the remote host instead of a login shell.
95 The options are as follows:
100 to try protocol version 1 only.
104 to try protocol version 2 only.
108 to use IPv4 addresses only.
112 to use IPv6 addresses only.
114 Enables forwarding of the authentication agent connection.
115 This can also be specified on a per-host basis in a configuration file.
117 Agent forwarding should be enabled with caution.
118 Users with the ability to bypass file permissions on the remote host
121 socket) can access the local agent through the forwarded connection.
122 An attacker cannot obtain key material from the agent,
123 however they can perform operations on the keys that enable them to
124 authenticate using the identities loaded into the agent.
126 Disables forwarding of the authentication agent connection.
127 .It Fl b Ar bind_address
130 on the local machine as the source address
132 Only useful on systems with more than one address.
134 Requests compression of all data (including stdin, stdout, stderr, and
135 data for forwarded X11, TCP and
138 The compression algorithm is the same used by
142 can be controlled by the
144 option for protocol version 1.
145 Compression is desirable on modem lines and other
146 slow connections, but will only slow down things on fast networks.
147 The default value can be set on a host-by-host basis in the
148 configuration files; see the
151 .It Fl c Ar cipher_spec
152 Selects the cipher specification for encrypting the session.
154 Protocol version 1 allows specification of a single cipher.
155 The supported values are
160 For protocol version 2,
162 is a comma-separated list of ciphers
163 listed in order of preference.
168 for more information.
171 .Oo Ar bind_address : Oc
177 application-level port forwarding.
178 This works by allocating a socket to listen to
180 on the local side, optionally bound to the specified
182 Whenever a connection is made to this port, the
183 connection is forwarded over the secure channel, and the application
184 protocol is then used to determine where to connect to from the
186 Currently the SOCKS4 and SOCKS5 protocols are supported, and
188 will act as a SOCKS server.
189 Only root can forward privileged ports.
190 Dynamic port forwardings can also be specified in the configuration file.
192 IPv6 addresses can be specified by enclosing the address in square brackets.
193 Only the superuser can forward privileged ports.
194 By default, the local port is bound in accordance with the
199 may be used to bind the connection to a specific address.
204 indicates that the listening port be bound for local use only, while an
207 indicates that the port should be available from all interfaces.
211 instead of standard error.
212 .It Fl e Ar escape_char
213 Sets the escape character for sessions with a pty (default:
215 The escape character is only recognized at the beginning of a line.
216 The escape character followed by a dot
218 closes the connection;
219 followed by control-Z suspends the connection;
220 and followed by itself sends the escape character once.
221 Setting the character to
223 disables any escapes and makes the session fully transparent.
224 .It Fl F Ar configfile
225 Specifies an alternative per-user configuration file.
226 If a configuration file is given on the command line,
227 the system-wide configuration file
228 .Pq Pa /etc/ssh/ssh_config
230 The default for the per-user configuration file is
235 to go to background just before command execution.
238 is going to ask for passwords or passphrases, but the user
239 wants it in the background.
242 The recommended way to start X11 programs at a remote site is with
244 .Ic ssh -f host xterm .
247 .Cm ExitOnForwardFailure
248 configuration option is set to
250 then a client started with
252 will wait for all remote port forwards to be successfully established
253 before placing itself in the background.
257 to print its configuration after evaluating
263 Allows remote hosts to connect to local forwarded ports.
264 If used on a multiplexed connection, then this option must be specified
265 on the master process.
267 Specify the PKCS#11 shared library
269 should use to communicate with a PKCS#11 token providing the user's
271 .It Fl i Ar identity_file
272 Selects a file from which the identity (private key) for
273 public key authentication is read.
276 for protocol version 1, and
278 .Pa ~/.ssh/id_ecdsa ,
279 .Pa ~/.ssh/id_ed25519
282 for protocol version 2.
283 Identity files may also be specified on
284 a per-host basis in the configuration file.
285 It is possible to have multiple
287 options (and multiple identities specified in
288 configuration files).
290 will also try to load certificate information from the filename obtained
293 to identity filenames.
295 Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
296 credentials to the server.
298 Disables forwarding (delegation) of GSSAPI credentials to the server.
301 .Oo Ar bind_address : Oc
302 .Ar port : host : hostport
305 Specifies that the given port on the local (client) host is to be
306 forwarded to the given host and port on the remote side.
307 This works by allocating a socket to listen to
309 on the local side, optionally bound to the specified
311 Whenever a connection is made to this port, the
312 connection is forwarded over the secure channel, and a connection is
317 from the remote machine.
318 Port forwardings can also be specified in the configuration file.
319 IPv6 addresses can be specified by enclosing the address in square brackets.
320 Only the superuser can forward privileged ports.
321 By default, the local port is bound in accordance with the
326 may be used to bind the connection to a specific address.
331 indicates that the listening port be bound for local use only, while an
334 indicates that the port should be available from all interfaces.
335 .It Fl l Ar login_name
336 Specifies the user to log in as on the remote machine.
337 This also may be specified on a per-host basis in the configuration file.
343 mode for connection sharing.
350 mode with confirmation required before slave connections are accepted.
351 Refer to the description of
357 Additionally, for protocol version 2 a comma-separated list of MAC
358 (message authentication code) algorithms can
359 be specified in order of preference.
362 keyword for more information.
364 Do not execute a remote command.
365 This is useful for just forwarding ports
366 (protocol version 2 only).
370 (actually, prevents reading from stdin).
371 This must be used when
373 is run in the background.
374 A common trick is to use this to run X11 programs on a remote machine.
376 .Ic ssh -n shadows.cs.hut.fi emacs &
377 will start an emacs on shadows.cs.hut.fi, and the X11
378 connection will be automatically forwarded over an encrypted channel.
381 program will be put in the background.
382 (This does not work if
384 needs to ask for a password or passphrase; see also the
388 Control an active connection multiplexing master process.
391 option is specified, the
393 argument is interpreted and passed to the master process.
396 (check that the master process is running),
398 (request forwardings without command execution),
400 (cancel forwardings),
402 (request the master to exit), and
404 (request the master to stop accepting further multiplexing requests).
406 Can be used to give options in the format used in the configuration file.
407 This is useful for specifying options for which there is no separate
409 For full details of the options listed below, and their possible values, see
412 .Bl -tag -width Ds -offset indent -compact
417 .It CanonicalizeFallbackLocal
418 .It CanonicalizeHostname
419 .It CanonicalizeMaxDots
420 .It CanonicalizePermittedCNAMEs
421 .It ChallengeResponseAuthentication
425 .It ClearAllForwardings
428 .It ConnectionAttempts
435 .It ExitOnForwardFailure
439 .It ForwardX11Timeout
440 .It ForwardX11Trusted
442 .It GlobalKnownHostsFile
443 .It GSSAPIAuthentication
444 .It GSSAPIDelegateCredentials
447 .It HostbasedAuthentication
448 .It HostbasedKeyTypes
449 .It HostKeyAlgorithms
455 .It KbdInteractiveAuthentication
456 .It KbdInteractiveDevices
463 .It NoHostAuthenticationForLocalhost
464 .It NumberOfPasswordPrompts
465 .It PasswordAuthentication
466 .It PermitLocalCommand
469 .It PreferredAuthentications
473 .It PubkeyAuthentication
477 .It RhostsRSAAuthentication
478 .It RSAAuthentication
480 .It ServerAliveInterval
481 .It ServerAliveCountMax
482 .It StreamLocalBindMask
483 .It StreamLocalBindUnlink
484 .It StrictHostKeyChecking
489 .It UsePrivilegedPort
491 .It UserKnownHostsFile
497 Port to connect to on the remote host.
498 This can be specified on a
499 per-host basis in the configuration file.
500 .It Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version
503 for the algorithms supported for the specified version 2.
504 The available features are:
506 (supported symmetric ciphers),
508 (supported symmetric ciphers that support authenticated encryption),
510 (supported message integrity codes),
512 (key exchange algorithms),
516 (supported SSH protocol versions).
519 Causes most warning and diagnostic messages to be suppressed.
522 .Oo Ar bind_address : Oc
523 .Ar port : host : hostport
526 Specifies that the given port on the remote (server) host is to be
527 forwarded to the given host and port on the local side.
528 This works by allocating a socket to listen to
530 on the remote side, and whenever a connection is made to this port, the
531 connection is forwarded over the secure channel, and a connection is
536 from the local machine.
538 Port forwardings can also be specified in the configuration file.
539 Privileged ports can be forwarded only when
540 logging in as root on the remote machine.
541 IPv6 addresses can be specified by enclosing the address in square brackets.
543 By default, the listening socket on the server will be bound to the loopback
545 This may be overridden by specifying a
551 indicates that the remote socket should listen on all interfaces.
554 will only succeed if the server's
556 option is enabled (see
557 .Xr sshd_config 5 ) .
563 the listen port will be dynamically allocated on the server and reported
564 to the client at run time.
565 When used together with
567 the allocated port will be printed to the standard output.
569 Specifies the location of a control socket for connection sharing,
572 to disable connection sharing.
573 Refer to the description of
581 May be used to request invocation of a subsystem on the remote system.
582 Subsystems are a feature of the SSH2 protocol which facilitate the use
583 of SSH as a secure transport for other applications (eg.\&
585 The subsystem is specified as the remote command.
587 Disable pseudo-tty allocation.
589 Force pseudo-tty allocation.
590 This can be used to execute arbitrary
591 screen-based programs on a remote machine, which can be very useful,
592 e.g. when implementing menu services.
595 options force tty allocation, even if
599 Display the version number and exit.
604 to print debugging messages about its progress.
606 debugging connection, authentication, and configuration problems.
609 options increase the verbosity.
611 .It Fl W Ar host : Ns Ar port
612 Requests that standard input and output on the client be forwarded to
616 over the secure channel.
620 .Cm ExitOnForwardFailure
622 .Cm ClearAllForwardings .
623 Works with Protocol version 2 only.
625 .Ar local_tun Ns Op : Ns Ar remote_tun
629 device forwarding with the specified
631 devices between the client
636 The devices may be specified by numerical ID or the keyword
638 which uses the next available tunnel device.
641 is not specified, it defaults to
651 directive is unset, it is set to the default tunnel mode, which is
654 Enables X11 forwarding.
655 This can also be specified on a per-host basis in a configuration file.
657 X11 forwarding should be enabled with caution.
658 Users with the ability to bypass file permissions on the remote host
659 (for the user's X authorization database)
660 can access the local X11 display through the forwarded connection.
661 An attacker may then be able to perform activities such as keystroke monitoring.
663 For this reason, X11 forwarding is subjected to X11 SECURITY extension
664 restrictions by default.
669 .Cm ForwardX11Trusted
672 for more information.
674 Disables X11 forwarding.
676 Enables trusted X11 forwarding.
677 Trusted X11 forwardings are not subjected to the X11 SECURITY extension
680 Send log information using the
683 By default this information is sent to stderr.
687 may additionally obtain configuration data from
688 a per-user configuration file and a system-wide configuration file.
689 The file format and configuration options are described in
692 The OpenSSH SSH client supports SSH protocols 1 and 2.
693 The default is to use protocol 2 only,
694 though this can be changed via the
703 Both protocols support similar authentication methods,
704 but protocol 2 is the default since
705 it provides additional mechanisms for confidentiality
706 (the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour)
707 and integrity (hmac-md5, hmac-sha1,
708 hmac-sha2-256, hmac-sha2-512,
709 umac-64, umac-128, hmac-ripemd160).
710 Protocol 1 lacks a strong mechanism for ensuring the
711 integrity of the connection.
713 The methods available for authentication are:
714 GSSAPI-based authentication,
715 host-based authentication,
716 public key authentication,
717 challenge-response authentication,
718 and password authentication.
719 Authentication methods are tried in the order specified above,
720 though protocol 2 has a configuration option to change the default order:
721 .Cm PreferredAuthentications .
723 Host-based authentication works as follows:
724 If the machine the user logs in from is listed in
727 .Pa /etc/shosts.equiv
728 on the remote machine, and the user names are
729 the same on both sides, or if the files
733 exist in the user's home directory on the
734 remote machine and contain a line containing the name of the client
735 machine and the name of the user on that machine, the user is
736 considered for login.
737 Additionally, the server
739 be able to verify the client's
740 host key (see the description of
741 .Pa /etc/ssh/ssh_known_hosts
743 .Pa ~/.ssh/known_hosts ,
745 for login to be permitted.
746 This authentication method closes security holes due to IP
747 spoofing, DNS spoofing, and routing spoofing.
748 [Note to the administrator:
749 .Pa /etc/hosts.equiv ,
751 and the rlogin/rsh protocol in general, are inherently insecure and should be
752 disabled if security is desired.]
754 Public key authentication works as follows:
755 The scheme is based on public-key cryptography,
757 where encryption and decryption are done using separate keys,
758 and it is unfeasible to derive the decryption key from the encryption key.
759 The idea is that each user creates a public/private
760 key pair for authentication purposes.
761 The server knows the public key, and only the user knows the private key.
763 implements public key authentication protocol automatically,
764 using one of the DSA, ECDSA, Ed25519 or RSA algorithms.
765 Protocol 1 is restricted to using only RSA keys,
766 but protocol 2 may use any.
767 The HISTORY section of
769 contains a brief discussion of the DSA and RSA algorithms.
772 .Pa ~/.ssh/authorized_keys
773 lists the public keys that are permitted for logging in.
774 When the user logs in, the
776 program tells the server which key pair it would like to use for
778 The client proves that it has access to the private key
779 and the server checks that the corresponding public key
780 is authorized to accept the account.
782 The user creates his/her key pair by running
784 This stores the private key in
791 .Pa ~/.ssh/id_ed25519
792 (protocol 2 Ed25519),
796 and stores the public key in
797 .Pa ~/.ssh/identity.pub
799 .Pa ~/.ssh/id_dsa.pub
801 .Pa ~/.ssh/id_ecdsa.pub
803 .Pa ~/.ssh/id_ed25519.pub
804 (protocol 2 Ed25519),
806 .Pa ~/.ssh/id_rsa.pub
808 in the user's home directory.
809 The user should then copy the public key
811 .Pa ~/.ssh/authorized_keys
812 in his/her home directory on the remote machine.
815 file corresponds to the conventional
817 file, and has one key
818 per line, though the lines can be very long.
819 After this, the user can log in without giving the password.
821 A variation on public key authentication
822 is available in the form of certificate authentication:
823 instead of a set of public/private keys,
824 signed certificates are used.
825 This has the advantage that a single trusted certification authority
826 can be used in place of many public/private keys.
827 See the CERTIFICATES section of
829 for more information.
831 The most convenient way to use public key or certificate authentication
832 may be with an authentication agent.
835 for more information.
837 Challenge-response authentication works as follows:
838 The server sends an arbitrary
840 text, and prompts for a response.
841 Protocol 2 allows multiple challenges and responses;
842 protocol 1 is restricted to just one challenge/response.
843 Examples of challenge-response authentication include
851 Finally, if other authentication methods fail,
853 prompts the user for a password.
854 The password is sent to the remote
855 host for checking; however, since all communications are encrypted,
856 the password cannot be seen by someone listening on the network.
859 automatically maintains and checks a database containing
860 identification for all hosts it has ever been used with.
861 Host keys are stored in
862 .Pa ~/.ssh/known_hosts
863 in the user's home directory.
864 Additionally, the file
865 .Pa /etc/ssh/ssh_known_hosts
866 is automatically checked for known hosts.
867 Any new hosts are automatically added to the user's file.
868 If a host's identification ever changes,
870 warns about this and disables password authentication to prevent
871 server spoofing or man-in-the-middle attacks,
872 which could otherwise be used to circumvent the encryption.
874 .Cm StrictHostKeyChecking
875 option can be used to control logins to machines whose
876 host key is not known or has changed.
878 When the user's identity has been accepted by the server, the server
879 either executes the given command, or logs into the machine and gives
880 the user a normal shell on the remote machine.
881 All communication with
882 the remote command or shell will be automatically encrypted.
884 If a pseudo-terminal has been allocated (normal login session), the
885 user may use the escape characters noted below.
887 If no pseudo-tty has been allocated,
888 the session is transparent and can be used to reliably transfer binary data.
889 On most systems, setting the escape character to
891 will also make the session transparent even if a tty is used.
893 The session terminates when the command or shell on the remote
894 machine exits and all X11 and TCP connections have been closed.
895 .Sh ESCAPE CHARACTERS
896 When a pseudo-terminal has been requested,
898 supports a number of functions through the use of an escape character.
900 A single tilde character can be sent as
902 or by following the tilde by a character other than those described below.
903 The escape character must always follow a newline to be interpreted as
905 The escape character can be changed in configuration files using the
907 configuration directive or on the command line by the
911 The supported escapes (assuming the default
921 List forwarded connections.
925 at logout when waiting for forwarded connection / X11 sessions to terminate.
927 Display a list of escape characters.
929 Send a BREAK to the remote system
930 (only useful for SSH protocol version 2 and if the peer supports it).
933 Currently this allows the addition of port forwardings using the
939 It also allows the cancellation of existing port-forwardings
942 .Fl KL Oo Ar bind_address : Oc Ar port
946 .Fl KR Oo Ar bind_address : Oc Ar port
950 .Fl KD Oo Ar bind_address : Oc Ar port
952 for dynamic port-forwardings.
953 .Ic !\& Ns Ar command
954 allows the user to execute a local command if the
955 .Ic PermitLocalCommand
958 Basic help is available, using the
962 Request rekeying of the connection
963 (only useful for SSH protocol version 2 and if the peer supports it).
965 Decrease the verbosity
967 when errors are being written to stderr.
969 Increase the verbosity
971 when errors are being written to stderr.
974 Forwarding of arbitrary TCP connections over the secure channel can
975 be specified either on the command line or in a configuration file.
976 One possible application of TCP forwarding is a secure connection to a
977 mail server; another is going through firewalls.
979 In the example below, we look at encrypting communication between
980 an IRC client and server, even though the IRC server does not directly
981 support encrypted communications.
982 This works as follows:
983 the user connects to the remote host using
985 specifying a port to be used to forward connections
986 to the remote server.
987 After that it is possible to start the service which is to be encrypted
988 on the client machine,
989 connecting to the same local port,
992 will encrypt and forward the connection.
994 The following example tunnels an IRC session from client machine
998 .Dq server.example.com :
999 .Bd -literal -offset 4n
1000 $ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
1001 $ irc -c '#users' -p 1234 pinky 127.0.0.1
1004 This tunnels a connection to IRC server
1005 .Dq server.example.com ,
1011 It doesn't matter which port is used,
1012 as long as it's greater than 1023
1013 (remember, only root can open sockets on privileged ports)
1014 and doesn't conflict with any ports already in use.
1015 The connection is forwarded to port 6667 on the remote server,
1016 since that's the standard port for IRC services.
1022 and the remote command
1024 is specified to allow an amount of time
1025 (10 seconds, in the example)
1026 to start the service which is to be tunnelled.
1027 If no connections are made within the time specified,
1035 (or see the description of the
1041 and the user is using X11 (the
1043 environment variable is set), the connection to the X11 display is
1044 automatically forwarded to the remote side in such a way that any X11
1045 programs started from the shell (or command) will go through the
1046 encrypted channel, and the connection to the real X server will be made
1047 from the local machine.
1048 The user should not manually set
1050 Forwarding of X11 connections can be
1051 configured on the command line or in configuration files.
1057 will point to the server machine, but with a display number greater than zero.
1058 This is normal, and happens because
1062 X server on the server machine for forwarding the
1063 connections over the encrypted channel.
1066 will also automatically set up Xauthority data on the server machine.
1067 For this purpose, it will generate a random authorization cookie,
1068 store it in Xauthority on the server, and verify that any forwarded
1069 connections carry this cookie and replace it by the real cookie when
1070 the connection is opened.
1071 The real authentication cookie is never
1072 sent to the server machine (and no cookies are sent in the plain).
1078 (or see the description of the
1083 the user is using an authentication agent, the connection to the agent
1084 is automatically forwarded to the remote side.
1085 .Sh VERIFYING HOST KEYS
1086 When connecting to a server for the first time,
1087 a fingerprint of the server's public key is presented to the user
1089 .Cm StrictHostKeyChecking
1091 Fingerprints can be determined using
1094 .Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1096 If the fingerprint is already known, it can be matched
1097 and the key can be accepted or rejected.
1098 Because of the difficulty of comparing host keys
1099 just by looking at fingerprint strings,
1100 there is also support to compare host keys visually,
1107 a small ASCII graphic gets displayed on every login to a server, no matter
1108 if the session itself is interactive or not.
1109 By learning the pattern a known server produces, a user can easily
1110 find out that the host key has changed when a completely different pattern
1112 Because these patterns are not unambiguous however, a pattern that looks
1113 similar to the pattern remembered only gives a good probability that the
1114 host key is the same, not guaranteed proof.
1116 To get a listing of the fingerprints along with their random art for
1117 all known hosts, the following command line can be used:
1119 .Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts
1121 If the fingerprint is unknown,
1122 an alternative method of verification is available:
1123 SSH fingerprints verified by DNS.
1124 An additional resource record (RR),
1126 is added to a zonefile
1127 and the connecting client is able to match the fingerprint
1128 with that of the key presented.
1130 In this example, we are connecting a client to a server,
1131 .Dq host.example.com .
1132 The SSHFP resource records should first be added to the zonefile for
1134 .Bd -literal -offset indent
1135 $ ssh-keygen -r host.example.com.
1138 The output lines will have to be added to the zonefile.
1139 To check that the zone is answering fingerprint queries:
1141 .Dl $ dig -t SSHFP host.example.com
1143 Finally the client connects:
1144 .Bd -literal -offset indent
1145 $ ssh -o "VerifyHostKeyDNS ask" host.example.com
1147 Matching host key fingerprint found in DNS.
1148 Are you sure you want to continue connecting (yes/no)?
1152 .Cm VerifyHostKeyDNS
1155 for more information.
1156 .Sh SSH-BASED VIRTUAL PRIVATE NETWORKS
1158 contains support for Virtual Private Network (VPN) tunnelling
1161 network pseudo-device,
1162 allowing two networks to be joined securely.
1165 configuration option
1167 controls whether the server supports this,
1168 and at what level (layer 2 or 3 traffic).
1170 The following example would connect client network 10.0.50.0/24
1171 with remote network 10.0.99.0/24 using a point-to-point connection
1172 from 10.1.1.1 to 10.1.1.2,
1173 provided that the SSH server running on the gateway to the remote network,
1174 at 192.168.1.15, allows it.
1177 .Bd -literal -offset indent
1178 # ssh -f -w 0:1 192.168.1.15 true
1179 # ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
1180 # route add 10.0.99.0/24 10.1.1.2
1184 .Bd -literal -offset indent
1185 # ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
1186 # route add 10.0.50.0/24 10.1.1.1
1189 Client access may be more finely tuned via the
1190 .Pa /root/.ssh/authorized_keys
1191 file (see below) and the
1194 The following entry would permit connections on
1198 and on tun device 2 from user
1203 .Dq forced-commands-only :
1204 .Bd -literal -offset 2n
1205 tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
1206 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
1209 Since an SSH-based setup entails a fair amount of overhead,
1210 it may be more suited to temporary setups,
1211 such as for wireless VPNs.
1212 More permanent VPNs are better provided by tools such as
1218 will normally set the following environment variables:
1219 .Bl -tag -width "SSH_ORIGINAL_COMMAND"
1223 variable indicates the location of the X11 server.
1224 It is automatically set by
1226 to point to a value of the form
1230 indicates the host where the shell runs, and
1232 is an integer \*(Ge 1.
1234 uses this special value to forward X11 connections over the secure
1236 The user should normally not set
1239 will render the X11 connection insecure (and will require the user to
1240 manually copy any required authorization cookies).
1242 Set to the path of the user's home directory.
1246 set for compatibility with systems that use this variable.
1248 Set to the path of the user's mailbox.
1252 as specified when compiling
1257 needs a passphrase, it will read the passphrase from the current
1258 terminal if it was run from a terminal.
1261 does not have a terminal associated with it but
1265 are set, it will execute the program specified by
1267 and open an X11 window to read the passphrase.
1268 This is particularly useful when calling
1273 (Note that on some machines it
1274 may be necessary to redirect the input from
1277 .It Ev SSH_AUTH_SOCK
1278 Identifies the path of a
1280 socket used to communicate with the agent.
1281 .It Ev SSH_CONNECTION
1282 Identifies the client and server ends of the connection.
1283 The variable contains
1284 four space-separated values: client IP address, client port number,
1285 server IP address, and server port number.
1286 .It Ev SSH_ORIGINAL_COMMAND
1287 This variable contains the original command line if a forced command
1289 It can be used to extract the original arguments.
1291 This is set to the name of the tty (path to the device) associated
1292 with the current shell or command.
1293 If the current session has no tty,
1294 this variable is not set.
1296 This variable is set to indicate the present time zone if it
1297 was set when the daemon was started (i.e. the daemon passes the value
1298 on to new connections).
1300 Set to the name of the user logging in.
1306 .Pa ~/.ssh/environment ,
1307 and adds lines of the format
1309 to the environment if the file exists and users are allowed to
1310 change their environment.
1311 For more information, see the
1312 .Cm PermitUserEnvironment
1316 .Bl -tag -width Ds -compact
1318 This file is used for host-based authentication (see above).
1319 On some machines this file may need to be
1320 world-readable if the user's home directory is on an NFS partition,
1324 Additionally, this file must be owned by the user,
1325 and must not have write permissions for anyone else.
1327 permission for most machines is read/write for the user, and not
1328 accessible by others.
1331 This file is used in exactly the same way as
1333 but allows host-based authentication without permitting login with
1337 This directory is the default location for all user-specific configuration
1338 and authentication information.
1339 There is no general requirement to keep the entire contents of this directory
1340 secret, but the recommended permissions are read/write/execute for the user,
1341 and not accessible by others.
1343 .It Pa ~/.ssh/authorized_keys
1344 Lists the public keys (DSA, ECDSA, Ed25519, RSA)
1345 that can be used for logging in as this user.
1346 The format of this file is described in the
1349 This file is not highly sensitive, but the recommended
1350 permissions are read/write for the user, and not accessible by others.
1352 .It Pa ~/.ssh/config
1353 This is the per-user configuration file.
1354 The file format and configuration options are described in
1356 Because of the potential for abuse, this file must have strict permissions:
1357 read/write for the user, and not writable by others.
1359 .It Pa ~/.ssh/environment
1360 Contains additional definitions for environment variables; see
1364 .It Pa ~/.ssh/identity
1365 .It Pa ~/.ssh/id_dsa
1366 .It Pa ~/.ssh/id_ecdsa
1367 .It Pa ~/.ssh/id_ed25519
1368 .It Pa ~/.ssh/id_rsa
1369 Contains the private key for authentication.
1371 contain sensitive data and should be readable by the user but not
1372 accessible by others (read/write/execute).
1374 will simply ignore a private key file if it is accessible by others.
1375 It is possible to specify a passphrase when
1376 generating the key which will be used to encrypt the
1377 sensitive part of this file using 3DES.
1379 .It Pa ~/.ssh/identity.pub
1380 .It Pa ~/.ssh/id_dsa.pub
1381 .It Pa ~/.ssh/id_ecdsa.pub
1382 .It Pa ~/.ssh/id_ed25519.pub
1383 .It Pa ~/.ssh/id_rsa.pub
1384 Contains the public key for authentication.
1386 sensitive and can (but need not) be readable by anyone.
1388 .It Pa ~/.ssh/known_hosts
1389 Contains a list of host keys for all hosts the user has logged into
1390 that are not already in the systemwide list of known host keys.
1393 for further details of the format of this file.
1396 Commands in this file are executed by
1398 when the user logs in, just before the user's shell (or command) is
1402 manual page for more information.
1404 .It Pa /etc/hosts.equiv
1405 This file is for host-based authentication (see above).
1406 It should only be writable by root.
1408 .It Pa /etc/shosts.equiv
1409 This file is used in exactly the same way as
1411 but allows host-based authentication without permitting login with
1414 .It Pa /etc/ssh/ssh_config
1415 Systemwide configuration file.
1416 The file format and configuration options are described in
1419 .It Pa /etc/ssh/ssh_host_key
1420 .It Pa /etc/ssh/ssh_host_dsa_key
1421 .It Pa /etc/ssh/ssh_host_ecdsa_key
1422 .It Pa /etc/ssh/ssh_host_ed25519_key
1423 .It Pa /etc/ssh/ssh_host_rsa_key
1424 These files contain the private parts of the host keys
1425 and are used for host-based authentication.
1426 If protocol version 1 is used,
1428 must be setuid root, since the host key is readable only by root.
1429 For protocol version 2,
1433 to access the host keys,
1434 eliminating the requirement that
1436 be setuid root when host-based authentication is used.
1441 .It Pa /etc/ssh/ssh_known_hosts
1442 Systemwide list of known host keys.
1443 This file should be prepared by the
1444 system administrator to contain the public host keys of all machines in the
1446 It should be world-readable.
1449 for further details of the format of this file.
1451 .It Pa /etc/ssh/sshrc
1452 Commands in this file are executed by
1454 when the user logs in, just before the user's shell (or command) is started.
1457 manual page for more information.
1461 exits with the exit status of the remote command or with 255
1462 if an error occurred.
1480 .%T The Secure Shell (SSH) Protocol Assigned Numbers
1488 .%T The Secure Shell (SSH) Protocol Architecture
1496 .%T The Secure Shell (SSH) Authentication Protocol
1504 .%T The Secure Shell (SSH) Transport Layer Protocol
1512 .%T The Secure Shell (SSH) Connection Protocol
1520 .%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
1528 .%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
1536 .%T The Secure Shell (SSH) Session Channel Break Extension
1545 .%T The Secure Shell (SSH) Transport Layer Encryption Modes
1552 .%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol
1561 .%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
1569 .%T The Secure Shell (SSH) Public Key File Format
1577 .%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
1584 .%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)
1585 .%T Hash Visualization: a New Technique to improve Real-World Security
1588 OpenSSH is a derivative of the original and free
1589 ssh 1.2.12 release by Tatu Ylonen.
1590 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1591 Theo de Raadt and Dug Song
1592 removed many bugs, re-added newer features and
1594 Markus Friedl contributed the support for SSH
1595 protocol versions 1.5 and 2.0.