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.348 2014/07/24 22:57:10 millert Exp $
37 .Dd $Mdocdate: July 24 2014 $
42 .Nd OpenSSH SSH client (remote login program)
46 .Op Fl 1246AaCfgKkMNnqsTtVvXxYy
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
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.
255 Allows remote hosts to connect to local forwarded ports.
256 If used on a multiplexed connection, then this option must be specified
257 on the master process.
259 Specify the PKCS#11 shared library
261 should use to communicate with a PKCS#11 token providing the user's
263 .It Fl i Ar identity_file
264 Selects a file from which the identity (private key) for
265 public key authentication is read.
268 for protocol version 1, and
270 .Pa ~/.ssh/id_ecdsa ,
271 .Pa ~/.ssh/id_ed25519
274 for protocol version 2.
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).
282 will also try to load certificate information from the filename obtained
285 to identity filenames.
287 Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
288 credentials to the server.
290 Disables forwarding (delegation) of GSSAPI credentials to the server.
293 .Oo Ar bind_address : Oc
294 .Ar port : host : hostport
297 Specifies that the given port on the local (client) host is to be
298 forwarded to the given host and port on the remote side.
299 This works by allocating a socket to listen to
301 on the local side, optionally bound to the specified
303 Whenever a connection is made to this port, the
304 connection is forwarded over the secure channel, and a connection is
309 from the remote machine.
310 Port forwardings can also be specified in the configuration file.
311 IPv6 addresses can be specified by enclosing the address in square brackets.
312 Only the superuser can forward privileged ports.
313 By default, the local port is bound in accordance with the
318 may be used to bind the connection to a specific address.
323 indicates that the listening port be bound for local use only, while an
326 indicates that the port should be available from all interfaces.
327 .It Fl l Ar login_name
328 Specifies the user to log in as on the remote machine.
329 This also may be specified on a per-host basis in the configuration file.
335 mode for connection sharing.
342 mode with confirmation required before slave connections are accepted.
343 Refer to the description of
349 Additionally, for protocol version 2 a comma-separated list of MAC
350 (message authentication code) algorithms can
351 be specified in order of preference.
354 keyword for more information.
356 Do not execute a remote command.
357 This is useful for just forwarding ports
358 (protocol version 2 only).
362 (actually, prevents reading from stdin).
363 This must be used when
365 is run in the background.
366 A common trick is to use this to run X11 programs on a remote machine.
368 .Ic ssh -n shadows.cs.hut.fi emacs &
369 will start an emacs on shadows.cs.hut.fi, and the X11
370 connection will be automatically forwarded over an encrypted channel.
373 program will be put in the background.
374 (This does not work if
376 needs to ask for a password or passphrase; see also the
380 Control an active connection multiplexing master process.
383 option is specified, the
385 argument is interpreted and passed to the master process.
388 (check that the master process is running),
390 (request forwardings without command execution),
392 (cancel forwardings),
394 (request the master to exit), and
396 (request the master to stop accepting further multiplexing requests).
398 Can be used to give options in the format used in the configuration file.
399 This is useful for specifying options for which there is no separate
401 For full details of the options listed below, and their possible values, see
404 .Bl -tag -width Ds -offset indent -compact
409 .It CanonicalizeFallbackLocal
410 .It CanonicalizeHostname
411 .It CanonicalizeMaxDots
412 .It CanonicalizePermittedCNAMEs
413 .It ChallengeResponseAuthentication
417 .It ClearAllForwardings
420 .It ConnectionAttempts
427 .It ExitOnForwardFailure
430 .It ForwardX11Timeout
431 .It ForwardX11Trusted
433 .It GlobalKnownHostsFile
434 .It GSSAPIAuthentication
435 .It GSSAPIDelegateCredentials
438 .It HostbasedAuthentication
439 .It HostKeyAlgorithms
445 .It KbdInteractiveAuthentication
446 .It KbdInteractiveDevices
453 .It NoHostAuthenticationForLocalhost
454 .It NumberOfPasswordPrompts
455 .It PasswordAuthentication
456 .It PermitLocalCommand
459 .It PreferredAuthentications
463 .It PubkeyAuthentication
467 .It RhostsRSAAuthentication
468 .It RSAAuthentication
470 .It ServerAliveInterval
471 .It ServerAliveCountMax
472 .It StreamLocalBindMask
473 .It StreamLocalBindUnlink
474 .It StrictHostKeyChecking
478 .It UsePrivilegedPort
480 .It UserKnownHostsFile
486 Port to connect to on the remote host.
487 This can be specified on a
488 per-host basis in the configuration file.
489 .It Fl Q Cm cipher | cipher-auth | mac | kex | key
492 for the algorithms supported for the specified version 2.
493 The available features are:
495 (supported symmetric ciphers),
497 (supported symmetric ciphers that support authenticated encryption),
499 (supported message integrity codes),
501 (key exchange algorithms),
506 Causes most warning and diagnostic messages to be suppressed.
509 .Oo Ar bind_address : Oc
510 .Ar port : host : hostport
513 Specifies that the given port on the remote (server) host is to be
514 forwarded to the given host and port on the local side.
515 This works by allocating a socket to listen to
517 on the remote side, and whenever a connection is made to this port, the
518 connection is forwarded over the secure channel, and a connection is
523 from the local machine.
525 Port forwardings can also be specified in the configuration file.
526 Privileged ports can be forwarded only when
527 logging in as root on the remote machine.
528 IPv6 addresses can be specified by enclosing the address in square brackets.
530 By default, the listening socket on the server will be bound to the loopback
532 This may be overridden by specifying a
538 indicates that the remote socket should listen on all interfaces.
541 will only succeed if the server's
543 option is enabled (see
544 .Xr sshd_config 5 ) .
550 the listen port will be dynamically allocated on the server and reported
551 to the client at run time.
552 When used together with
554 the allocated port will be printed to the standard output.
556 Specifies the location of a control socket for connection sharing,
559 to disable connection sharing.
560 Refer to the description of
568 May be used to request invocation of a subsystem on the remote system.
569 Subsystems are a feature of the SSH2 protocol which facilitate the use
570 of SSH as a secure transport for other applications (eg.\&
572 The subsystem is specified as the remote command.
574 Disable pseudo-tty allocation.
576 Force pseudo-tty allocation.
577 This can be used to execute arbitrary
578 screen-based programs on a remote machine, which can be very useful,
579 e.g. when implementing menu services.
582 options force tty allocation, even if
586 Display the version number and exit.
591 to print debugging messages about its progress.
593 debugging connection, authentication, and configuration problems.
596 options increase the verbosity.
598 .It Fl W Ar host : Ns Ar port
599 Requests that standard input and output on the client be forwarded to
603 over the secure channel.
607 .Cm ExitOnForwardFailure
609 .Cm ClearAllForwardings .
610 Works with Protocol version 2 only.
612 .Ar local_tun Ns Op : Ns Ar remote_tun
616 device forwarding with the specified
618 devices between the client
623 The devices may be specified by numerical ID or the keyword
625 which uses the next available tunnel device.
628 is not specified, it defaults to
638 directive is unset, it is set to the default tunnel mode, which is
641 Enables X11 forwarding.
642 This can also be specified on a per-host basis in a configuration file.
644 X11 forwarding should be enabled with caution.
645 Users with the ability to bypass file permissions on the remote host
646 (for the user's X authorization database)
647 can access the local X11 display through the forwarded connection.
648 An attacker may then be able to perform activities such as keystroke monitoring.
650 For this reason, X11 forwarding is subjected to X11 SECURITY extension
651 restrictions by default.
656 .Cm ForwardX11Trusted
659 for more information.
661 Disables X11 forwarding.
663 Enables trusted X11 forwarding.
664 Trusted X11 forwardings are not subjected to the X11 SECURITY extension
667 Send log information using the
670 By default this information is sent to stderr.
674 may additionally obtain configuration data from
675 a per-user configuration file and a system-wide configuration file.
676 The file format and configuration options are described in
679 The OpenSSH SSH client supports SSH protocols 1 and 2.
680 The default is to use protocol 2 only,
681 though this can be changed via the
690 Both protocols support similar authentication methods,
691 but protocol 2 is the default since
692 it provides additional mechanisms for confidentiality
693 (the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour)
694 and integrity (hmac-md5, hmac-sha1,
695 hmac-sha2-256, hmac-sha2-512,
696 umac-64, umac-128, hmac-ripemd160).
697 Protocol 1 lacks a strong mechanism for ensuring the
698 integrity of the connection.
700 The methods available for authentication are:
701 GSSAPI-based authentication,
702 host-based authentication,
703 public key authentication,
704 challenge-response authentication,
705 and password authentication.
706 Authentication methods are tried in the order specified above,
707 though protocol 2 has a configuration option to change the default order:
708 .Cm PreferredAuthentications .
710 Host-based authentication works as follows:
711 If the machine the user logs in from is listed in
714 .Pa /etc/shosts.equiv
715 on the remote machine, and the user names are
716 the same on both sides, or if the files
720 exist in the user's home directory on the
721 remote machine and contain a line containing the name of the client
722 machine and the name of the user on that machine, the user is
723 considered for login.
724 Additionally, the server
726 be able to verify the client's
727 host key (see the description of
728 .Pa /etc/ssh/ssh_known_hosts
730 .Pa ~/.ssh/known_hosts ,
732 for login to be permitted.
733 This authentication method closes security holes due to IP
734 spoofing, DNS spoofing, and routing spoofing.
735 [Note to the administrator:
736 .Pa /etc/hosts.equiv ,
738 and the rlogin/rsh protocol in general, are inherently insecure and should be
739 disabled if security is desired.]
741 Public key authentication works as follows:
742 The scheme is based on public-key cryptography,
744 where encryption and decryption are done using separate keys,
745 and it is unfeasible to derive the decryption key from the encryption key.
746 The idea is that each user creates a public/private
747 key pair for authentication purposes.
748 The server knows the public key, and only the user knows the private key.
750 implements public key authentication protocol automatically,
751 using one of the DSA, ECDSA, ED25519 or RSA algorithms.
752 Protocol 1 is restricted to using only RSA keys,
753 but protocol 2 may use any.
754 The HISTORY section of
756 contains a brief discussion of the DSA and RSA algorithms.
759 .Pa ~/.ssh/authorized_keys
760 lists the public keys that are permitted for logging in.
761 When the user logs in, the
763 program tells the server which key pair it would like to use for
765 The client proves that it has access to the private key
766 and the server checks that the corresponding public key
767 is authorized to accept the account.
769 The user creates his/her key pair by running
771 This stores the private key in
778 .Pa ~/.ssh/id_ed25519
779 (protocol 2 ED25519),
783 and stores the public key in
784 .Pa ~/.ssh/identity.pub
786 .Pa ~/.ssh/id_dsa.pub
788 .Pa ~/.ssh/id_ecdsa.pub
790 .Pa ~/.ssh/id_ed25519.pub
791 (protocol 2 ED25519),
793 .Pa ~/.ssh/id_rsa.pub
795 in the user's home directory.
796 The user should then copy the public key
798 .Pa ~/.ssh/authorized_keys
799 in his/her home directory on the remote machine.
802 file corresponds to the conventional
804 file, and has one key
805 per line, though the lines can be very long.
806 After this, the user can log in without giving the password.
808 A variation on public key authentication
809 is available in the form of certificate authentication:
810 instead of a set of public/private keys,
811 signed certificates are used.
812 This has the advantage that a single trusted certification authority
813 can be used in place of many public/private keys.
814 See the CERTIFICATES section of
816 for more information.
818 The most convenient way to use public key or certificate authentication
819 may be with an authentication agent.
822 for more information.
824 Challenge-response authentication works as follows:
825 The server sends an arbitrary
827 text, and prompts for a response.
828 Protocol 2 allows multiple challenges and responses;
829 protocol 1 is restricted to just one challenge/response.
830 Examples of challenge-response authentication include
838 Finally, if other authentication methods fail,
840 prompts the user for a password.
841 The password is sent to the remote
842 host for checking; however, since all communications are encrypted,
843 the password cannot be seen by someone listening on the network.
846 automatically maintains and checks a database containing
847 identification for all hosts it has ever been used with.
848 Host keys are stored in
849 .Pa ~/.ssh/known_hosts
850 in the user's home directory.
851 Additionally, the file
852 .Pa /etc/ssh/ssh_known_hosts
853 is automatically checked for known hosts.
854 Any new hosts are automatically added to the user's file.
855 If a host's identification ever changes,
857 warns about this and disables password authentication to prevent
858 server spoofing or man-in-the-middle attacks,
859 which could otherwise be used to circumvent the encryption.
861 .Cm StrictHostKeyChecking
862 option can be used to control logins to machines whose
863 host key is not known or has changed.
865 When the user's identity has been accepted by the server, the server
866 either executes the given command, or logs into the machine and gives
867 the user a normal shell on the remote machine.
868 All communication with
869 the remote command or shell will be automatically encrypted.
871 If a pseudo-terminal has been allocated (normal login session), the
872 user may use the escape characters noted below.
874 If no pseudo-tty has been allocated,
875 the session is transparent and can be used to reliably transfer binary data.
876 On most systems, setting the escape character to
878 will also make the session transparent even if a tty is used.
880 The session terminates when the command or shell on the remote
881 machine exits and all X11 and TCP connections have been closed.
882 .Sh ESCAPE CHARACTERS
883 When a pseudo-terminal has been requested,
885 supports a number of functions through the use of an escape character.
887 A single tilde character can be sent as
889 or by following the tilde by a character other than those described below.
890 The escape character must always follow a newline to be interpreted as
892 The escape character can be changed in configuration files using the
894 configuration directive or on the command line by the
898 The supported escapes (assuming the default
908 List forwarded connections.
912 at logout when waiting for forwarded connection / X11 sessions to terminate.
914 Display a list of escape characters.
916 Send a BREAK to the remote system
917 (only useful for SSH protocol version 2 and if the peer supports it).
920 Currently this allows the addition of port forwardings using the
926 It also allows the cancellation of existing port-forwardings
929 .Fl KL Oo Ar bind_address : Oc Ar port
933 .Fl KR Oo Ar bind_address : Oc Ar port
937 .Fl KD Oo Ar bind_address : Oc Ar port
939 for dynamic port-forwardings.
940 .Ic !\& Ns Ar command
941 allows the user to execute a local command if the
942 .Ic PermitLocalCommand
945 Basic help is available, using the
949 Request rekeying of the connection
950 (only useful for SSH protocol version 2 and if the peer supports it).
952 Decrease the verbosity
954 when errors are being written to stderr.
956 Increase the verbosity
958 when errors are being written to stderr.
961 Forwarding of arbitrary TCP connections over the secure channel can
962 be specified either on the command line or in a configuration file.
963 One possible application of TCP forwarding is a secure connection to a
964 mail server; another is going through firewalls.
966 In the example below, we look at encrypting communication between
967 an IRC client and server, even though the IRC server does not directly
968 support encrypted communications.
969 This works as follows:
970 the user connects to the remote host using
972 specifying a port to be used to forward connections
973 to the remote server.
974 After that it is possible to start the service which is to be encrypted
975 on the client machine,
976 connecting to the same local port,
979 will encrypt and forward the connection.
981 The following example tunnels an IRC session from client machine
985 .Dq server.example.com :
986 .Bd -literal -offset 4n
987 $ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
988 $ irc -c '#users' -p 1234 pinky 127.0.0.1
991 This tunnels a connection to IRC server
992 .Dq server.example.com ,
998 It doesn't matter which port is used,
999 as long as it's greater than 1023
1000 (remember, only root can open sockets on privileged ports)
1001 and doesn't conflict with any ports already in use.
1002 The connection is forwarded to port 6667 on the remote server,
1003 since that's the standard port for IRC services.
1009 and the remote command
1011 is specified to allow an amount of time
1012 (10 seconds, in the example)
1013 to start the service which is to be tunnelled.
1014 If no connections are made within the time specified,
1022 (or see the description of the
1028 and the user is using X11 (the
1030 environment variable is set), the connection to the X11 display is
1031 automatically forwarded to the remote side in such a way that any X11
1032 programs started from the shell (or command) will go through the
1033 encrypted channel, and the connection to the real X server will be made
1034 from the local machine.
1035 The user should not manually set
1037 Forwarding of X11 connections can be
1038 configured on the command line or in configuration files.
1044 will point to the server machine, but with a display number greater than zero.
1045 This is normal, and happens because
1049 X server on the server machine for forwarding the
1050 connections over the encrypted channel.
1053 will also automatically set up Xauthority data on the server machine.
1054 For this purpose, it will generate a random authorization cookie,
1055 store it in Xauthority on the server, and verify that any forwarded
1056 connections carry this cookie and replace it by the real cookie when
1057 the connection is opened.
1058 The real authentication cookie is never
1059 sent to the server machine (and no cookies are sent in the plain).
1065 (or see the description of the
1070 the user is using an authentication agent, the connection to the agent
1071 is automatically forwarded to the remote side.
1072 .Sh VERIFYING HOST KEYS
1073 When connecting to a server for the first time,
1074 a fingerprint of the server's public key is presented to the user
1076 .Cm StrictHostKeyChecking
1078 Fingerprints can be determined using
1081 .Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1083 If the fingerprint is already known, it can be matched
1084 and the key can be accepted or rejected.
1085 Because of the difficulty of comparing host keys
1086 just by looking at hex strings,
1087 there is also support to compare host keys visually,
1094 a small ASCII graphic gets displayed on every login to a server, no matter
1095 if the session itself is interactive or not.
1096 By learning the pattern a known server produces, a user can easily
1097 find out that the host key has changed when a completely different pattern
1099 Because these patterns are not unambiguous however, a pattern that looks
1100 similar to the pattern remembered only gives a good probability that the
1101 host key is the same, not guaranteed proof.
1103 To get a listing of the fingerprints along with their random art for
1104 all known hosts, the following command line can be used:
1106 .Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts
1108 If the fingerprint is unknown,
1109 an alternative method of verification is available:
1110 SSH fingerprints verified by DNS.
1111 An additional resource record (RR),
1113 is added to a zonefile
1114 and the connecting client is able to match the fingerprint
1115 with that of the key presented.
1117 In this example, we are connecting a client to a server,
1118 .Dq host.example.com .
1119 The SSHFP resource records should first be added to the zonefile for
1121 .Bd -literal -offset indent
1122 $ ssh-keygen -r host.example.com.
1125 The output lines will have to be added to the zonefile.
1126 To check that the zone is answering fingerprint queries:
1128 .Dl $ dig -t SSHFP host.example.com
1130 Finally the client connects:
1131 .Bd -literal -offset indent
1132 $ ssh -o "VerifyHostKeyDNS ask" host.example.com
1134 Matching host key fingerprint found in DNS.
1135 Are you sure you want to continue connecting (yes/no)?
1139 .Cm VerifyHostKeyDNS
1142 for more information.
1143 .Sh SSH-BASED VIRTUAL PRIVATE NETWORKS
1145 contains support for Virtual Private Network (VPN) tunnelling
1148 network pseudo-device,
1149 allowing two networks to be joined securely.
1152 configuration option
1154 controls whether the server supports this,
1155 and at what level (layer 2 or 3 traffic).
1157 The following example would connect client network 10.0.50.0/24
1158 with remote network 10.0.99.0/24 using a point-to-point connection
1159 from 10.1.1.1 to 10.1.1.2,
1160 provided that the SSH server running on the gateway to the remote network,
1161 at 192.168.1.15, allows it.
1164 .Bd -literal -offset indent
1165 # ssh -f -w 0:1 192.168.1.15 true
1166 # ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
1167 # route add 10.0.99.0/24 10.1.1.2
1171 .Bd -literal -offset indent
1172 # ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
1173 # route add 10.0.50.0/24 10.1.1.1
1176 Client access may be more finely tuned via the
1177 .Pa /root/.ssh/authorized_keys
1178 file (see below) and the
1181 The following entry would permit connections on
1185 and on tun device 2 from user
1190 .Dq forced-commands-only :
1191 .Bd -literal -offset 2n
1192 tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
1193 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
1196 Since an SSH-based setup entails a fair amount of overhead,
1197 it may be more suited to temporary setups,
1198 such as for wireless VPNs.
1199 More permanent VPNs are better provided by tools such as
1205 will normally set the following environment variables:
1206 .Bl -tag -width "SSH_ORIGINAL_COMMAND"
1210 variable indicates the location of the X11 server.
1211 It is automatically set by
1213 to point to a value of the form
1217 indicates the host where the shell runs, and
1219 is an integer \*(Ge 1.
1221 uses this special value to forward X11 connections over the secure
1223 The user should normally not set
1226 will render the X11 connection insecure (and will require the user to
1227 manually copy any required authorization cookies).
1229 Set to the path of the user's home directory.
1233 set for compatibility with systems that use this variable.
1235 Set to the path of the user's mailbox.
1239 as specified when compiling
1244 needs a passphrase, it will read the passphrase from the current
1245 terminal if it was run from a terminal.
1248 does not have a terminal associated with it but
1252 are set, it will execute the program specified by
1254 and open an X11 window to read the passphrase.
1255 This is particularly useful when calling
1260 (Note that on some machines it
1261 may be necessary to redirect the input from
1264 .It Ev SSH_AUTH_SOCK
1265 Identifies the path of a
1267 socket used to communicate with the agent.
1268 .It Ev SSH_CONNECTION
1269 Identifies the client and server ends of the connection.
1270 The variable contains
1271 four space-separated values: client IP address, client port number,
1272 server IP address, and server port number.
1273 .It Ev SSH_ORIGINAL_COMMAND
1274 This variable contains the original command line if a forced command
1276 It can be used to extract the original arguments.
1278 This is set to the name of the tty (path to the device) associated
1279 with the current shell or command.
1280 If the current session has no tty,
1281 this variable is not set.
1283 This variable is set to indicate the present time zone if it
1284 was set when the daemon was started (i.e. the daemon passes the value
1285 on to new connections).
1287 Set to the name of the user logging in.
1293 .Pa ~/.ssh/environment ,
1294 and adds lines of the format
1296 to the environment if the file exists and users are allowed to
1297 change their environment.
1298 For more information, see the
1299 .Cm PermitUserEnvironment
1303 .Bl -tag -width Ds -compact
1305 This file is used for host-based authentication (see above).
1306 On some machines this file may need to be
1307 world-readable if the user's home directory is on an NFS partition,
1311 Additionally, this file must be owned by the user,
1312 and must not have write permissions for anyone else.
1314 permission for most machines is read/write for the user, and not
1315 accessible by others.
1318 This file is used in exactly the same way as
1320 but allows host-based authentication without permitting login with
1324 This directory is the default location for all user-specific configuration
1325 and authentication information.
1326 There is no general requirement to keep the entire contents of this directory
1327 secret, but the recommended permissions are read/write/execute for the user,
1328 and not accessible by others.
1330 .It Pa ~/.ssh/authorized_keys
1331 Lists the public keys (DSA, ECDSA, ED25519, RSA)
1332 that can be used for logging in as this user.
1333 The format of this file is described in the
1336 This file is not highly sensitive, but the recommended
1337 permissions are read/write for the user, and not accessible by others.
1339 .It Pa ~/.ssh/config
1340 This is the per-user configuration file.
1341 The file format and configuration options are described in
1343 Because of the potential for abuse, this file must have strict permissions:
1344 read/write for the user, and not writable by others.
1346 .It Pa ~/.ssh/environment
1347 Contains additional definitions for environment variables; see
1351 .It Pa ~/.ssh/identity
1352 .It Pa ~/.ssh/id_dsa
1353 .It Pa ~/.ssh/id_ecdsa
1354 .It Pa ~/.ssh/id_ed25519
1355 .It Pa ~/.ssh/id_rsa
1356 Contains the private key for authentication.
1358 contain sensitive data and should be readable by the user but not
1359 accessible by others (read/write/execute).
1361 will simply ignore a private key file if it is accessible by others.
1362 It is possible to specify a passphrase when
1363 generating the key which will be used to encrypt the
1364 sensitive part of this file using 3DES.
1366 .It Pa ~/.ssh/identity.pub
1367 .It Pa ~/.ssh/id_dsa.pub
1368 .It Pa ~/.ssh/id_ecdsa.pub
1369 .It Pa ~/.ssh/id_ed25519.pub
1370 .It Pa ~/.ssh/id_rsa.pub
1371 Contains the public key for authentication.
1373 sensitive and can (but need not) be readable by anyone.
1375 .It Pa ~/.ssh/known_hosts
1376 Contains a list of host keys for all hosts the user has logged into
1377 that are not already in the systemwide list of known host keys.
1380 for further details of the format of this file.
1383 Commands in this file are executed by
1385 when the user logs in, just before the user's shell (or command) is
1389 manual page for more information.
1391 .It Pa /etc/hosts.equiv
1392 This file is for host-based authentication (see above).
1393 It should only be writable by root.
1395 .It Pa /etc/shosts.equiv
1396 This file is used in exactly the same way as
1398 but allows host-based authentication without permitting login with
1401 .It Pa /etc/ssh/ssh_config
1402 Systemwide configuration file.
1403 The file format and configuration options are described in
1406 .It Pa /etc/ssh/ssh_host_key
1407 .It Pa /etc/ssh/ssh_host_dsa_key
1408 .It Pa /etc/ssh/ssh_host_ecdsa_key
1409 .It Pa /etc/ssh/ssh_host_ed25519_key
1410 .It Pa /etc/ssh/ssh_host_rsa_key
1411 These files contain the private parts of the host keys
1412 and are used for host-based authentication.
1413 If protocol version 1 is used,
1415 must be setuid root, since the host key is readable only by root.
1416 For protocol version 2,
1420 to access the host keys,
1421 eliminating the requirement that
1423 be setuid root when host-based authentication is used.
1428 .It Pa /etc/ssh/ssh_known_hosts
1429 Systemwide list of known host keys.
1430 This file should be prepared by the
1431 system administrator to contain the public host keys of all machines in the
1433 It should be world-readable.
1436 for further details of the format of this file.
1438 .It Pa /etc/ssh/sshrc
1439 Commands in this file are executed by
1441 when the user logs in, just before the user's shell (or command) is started.
1444 manual page for more information.
1448 exits with the exit status of the remote command or with 255
1449 if an error occurred.
1467 .%T The Secure Shell (SSH) Protocol Assigned Numbers
1475 .%T The Secure Shell (SSH) Protocol Architecture
1483 .%T The Secure Shell (SSH) Authentication Protocol
1491 .%T The Secure Shell (SSH) Transport Layer Protocol
1499 .%T The Secure Shell (SSH) Connection Protocol
1507 .%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
1515 .%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
1523 .%T The Secure Shell (SSH) Session Channel Break Extension
1532 .%T The Secure Shell (SSH) Transport Layer Encryption Modes
1539 .%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol
1548 .%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
1556 .%T The Secure Shell (SSH) Public Key File Format
1564 .%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
1571 .%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)
1572 .%T Hash Visualization: a New Technique to improve Real-World Security
1575 OpenSSH is a derivative of the original and free
1576 ssh 1.2.12 release by Tatu Ylonen.
1577 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1578 Theo de Raadt and Dug Song
1579 removed many bugs, re-added newer features and
1581 Markus Friedl contributed the support for SSH
1582 protocol versions 1.5 and 2.0.