jcs's openbsd hax
openbsd
at jcs 1804 lines 48 kB view raw
1.\" 2.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 3.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4.\" All rights reserved 5.\" 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". 11.\" 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. 15.\" 16.\" Redistribution and use in source and binary forms, with or without 17.\" modification, are permitted provided that the following conditions 18.\" are met: 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. 24.\" 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. 35.\" 36.\" $OpenBSD: ssh.1,v 1.447 2025/12/22 01:17:31 djm Exp $ 37.Dd $Mdocdate: December 22 2025 $ 38.Dt SSH 1 39.Os 40.Sh NAME 41.Nm ssh 42.Nd OpenSSH remote login client 43.Sh SYNOPSIS 44.Nm ssh 45.Op Fl 46AaCfGgKkMNnqsTtVvXxYy 46.Op Fl B Ar bind_interface 47.Op Fl b Ar bind_address 48.Op Fl c Ar cipher_spec 49.Op Fl D Oo Ar bind_address : Oc Ns Ar port 50.Op Fl E Ar log_file 51.Op Fl e Ar escape_char 52.Op Fl F Ar configfile 53.Op Fl I Ar pkcs11 54.Op Fl i Ar identity_file 55.Op Fl J Ar destination 56.Op Fl L Ar address 57.Op Fl l Ar login_name 58.Op Fl m Ar mac_spec 59.Op Fl O Ar ctl_cmd 60.Op Fl o Ar option 61.Op Fl P Ar tag 62.Op Fl p Ar port 63.Op Fl R Ar address 64.Op Fl S Ar ctl_path 65.Op Fl W Ar host : Ns Ar port 66.Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun 67.Ar destination 68.Op Ar command Op Ar argument ... 69.Nm 70.Op Fl Q Ar query_option 71.Sh DESCRIPTION 72.Nm 73(SSH client) is a program for logging into a remote machine and for 74executing commands on a remote machine. 75It is intended to provide secure encrypted communications between 76two untrusted hosts over an insecure network. 77X11 connections, arbitrary TCP ports and 78.Ux Ns -domain 79sockets can also be forwarded over the secure channel. 80.Pp 81.Nm 82connects and logs into the specified 83.Ar destination , 84which may be specified as either 85.Sm off 86.Oo user @ Oc hostname 87.Sm on 88or a URI of the form 89.Sm off 90.No ssh:// Oo user @ Oc hostname Op : port . 91.Sm on 92The user must prove 93their identity to the remote machine using one of several methods 94(see below). 95.Pp 96If a 97.Ar command 98is specified, 99it will be executed on the remote host instead of a login shell. 100A complete command line may be specified as 101.Ar command , 102or it may have additional arguments. 103If supplied, the arguments will be appended to the command, separated by 104spaces, before it is sent to the server to be executed. 105.Pp 106The options are as follows: 107.Pp 108.Bl -tag -width Ds -compact 109.It Fl 4 110Forces 111.Nm 112to use IPv4 addresses only. 113.Pp 114.It Fl 6 115Forces 116.Nm 117to use IPv6 addresses only. 118.Pp 119.It Fl A 120Enables forwarding of connections from an authentication agent such as 121.Xr ssh-agent 1 . 122This can also be specified on a per-host basis in a configuration file. 123.Pp 124Agent forwarding should be enabled with caution. 125Users with the ability to bypass file permissions on the remote host 126(for the agent's 127.Ux Ns -domain 128socket) can access the local agent through the forwarded connection. 129An attacker cannot obtain key material from the agent, 130however they can perform operations on the keys that enable them to 131authenticate using the identities loaded into the agent. 132A safer alternative may be to use a jump host 133(see 134.Fl J ) . 135.Pp 136.It Fl a 137Disables forwarding of the authentication agent connection. 138.Pp 139.It Fl B Ar bind_interface 140Bind to the address of 141.Ar bind_interface 142before attempting to connect to the destination host. 143This is only useful on systems with more than one address. 144.Pp 145.It Fl b Ar bind_address 146Use 147.Ar bind_address 148on the local machine as the source address 149of the connection. 150Only useful on systems with more than one address. 151.Pp 152.It Fl C 153Requests compression of all data (including stdin, stdout, stderr, and 154data for forwarded X11, TCP and 155.Ux Ns -domain 156connections). 157The compression algorithm is the same used by 158.Xr gzip 1 . 159Compression is desirable on modem lines and other 160slow connections, but will only slow down things on fast networks. 161The default value can be set on a host-by-host basis in the 162configuration files; see the 163.Cm Compression 164option in 165.Xr ssh_config 5 . 166.Pp 167.It Fl c Ar cipher_spec 168Selects the cipher specification for encrypting the session. 169.Ar cipher_spec 170is a comma-separated list of ciphers 171listed in order of preference. 172See the 173.Cm Ciphers 174keyword in 175.Xr ssh_config 5 176for more information. 177.Pp 178.It Fl D Xo 179.Sm off 180.Oo Ar bind_address : Oc 181.Ar port 182.Sm on 183.Xc 184Specifies a local 185.Dq dynamic 186application-level port forwarding. 187This works by allocating a socket to listen to 188.Ar port 189on the local side, optionally bound to the specified 190.Ar bind_address . 191Whenever a connection is made to this port, the 192connection is forwarded over the secure channel, and the application 193protocol is then used to determine where to connect to from the 194remote machine. 195Currently the SOCKS4 and SOCKS5 protocols are supported, and 196.Nm 197will act as a SOCKS server. 198Only root can forward privileged ports. 199Dynamic port forwardings can also be specified in the configuration file. 200.Pp 201IPv6 addresses can be specified by enclosing the address in square brackets. 202Only the superuser can forward privileged ports. 203By default, the local port is bound in accordance with the 204.Cm GatewayPorts 205setting. 206However, an explicit 207.Ar bind_address 208may be used to bind the connection to a specific address. 209The 210.Ar bind_address 211of 212.Dq localhost 213indicates that the listening port be bound for local use only, while an 214empty address or 215.Sq * 216indicates that the port should be available from all interfaces. 217.Pp 218.It Fl E Ar log_file 219Append debug logs to 220.Ar log_file 221instead of standard error. 222.Pp 223.It Fl e Ar escape_char 224Sets the escape character for sessions with a pty (default: 225.Ql ~ ) . 226The escape character is only recognized at the beginning of a line. 227The escape character followed by a dot 228.Pq Ql \&. 229closes the connection; 230followed by control-Z suspends the connection; 231and followed by itself sends the escape character once. 232Setting the character to 233.Dq none 234disables any escapes and makes the session fully transparent. 235.Pp 236.It Fl F Ar configfile 237Specifies an alternative per-user configuration file. 238If a configuration file is given on the command line, 239the system-wide configuration file 240.Pq Pa /etc/ssh/ssh_config 241will be ignored. 242The default for the per-user configuration file is 243.Pa ~/.ssh/config . 244If set to 245.Dq none , 246no configuration files will be read. 247.Pp 248.It Fl f 249Requests 250.Nm 251to go to background just before command execution. 252This is useful if 253.Nm 254is going to ask for passwords or passphrases, but the user 255wants it in the background. 256This implies 257.Fl n . 258The recommended way to start X11 programs at a remote site is with 259something like 260.Ic ssh -f host xterm . 261.Pp 262If the 263.Cm ExitOnForwardFailure 264configuration option is set to 265.Dq yes , 266then a client started with 267.Fl f 268will wait for all remote port forwards to be successfully established 269before placing itself in the background. 270Refer to the description of 271.Cm ForkAfterAuthentication 272in 273.Xr ssh_config 5 274for details. 275.Pp 276.It Fl G 277Causes 278.Nm 279to print its configuration after evaluating 280.Cm Host 281and 282.Cm Match 283blocks and exit. 284.Pp 285.It Fl g 286Allows remote hosts to connect to local forwarded ports. 287If used on a multiplexed connection, then this option must be specified 288on the master process. 289.Pp 290.It Fl I Ar pkcs11 291Specify the PKCS#11 shared library 292.Nm 293should use to communicate with a PKCS#11 token providing keys for user 294authentication. 295.Pp 296.It Fl i Ar identity_file 297Selects a file from which the identity (private key) for 298public key authentication is read. 299You can also specify a public key file to use the corresponding 300private key that is loaded in 301.Xr ssh-agent 1 302when the private key file is not present locally. 303The default is 304.Pa ~/.ssh/id_rsa , 305.Pa ~/.ssh/id_ecdsa , 306.Pa ~/.ssh/id_ecdsa_sk , 307.Pa ~/.ssh/id_ed25519 308and 309.Pa ~/.ssh/id_ed25519_sk . 310Identity files may also be specified on 311a per-host basis in the configuration file. 312It is possible to have multiple 313.Fl i 314options (and multiple identities specified in 315configuration files). 316If no certificates have been explicitly specified by the 317.Cm CertificateFile 318directive, 319.Nm 320will also try to load certificate information from the filename obtained 321by appending 322.Pa -cert.pub 323to identity filenames. 324.Pp 325.It Fl J Ar destination 326Connect to the target host by first making an 327.Nm 328connection to the jump host described by 329.Ar destination 330and then establishing a TCP forwarding to the ultimate destination from 331there. 332Multiple jump hops may be specified separated by comma characters. 333IPv6 addresses can be specified by enclosing the address in square brackets. 334This is a shortcut to specify a 335.Cm ProxyJump 336configuration directive. 337Note that configuration directives supplied on the command-line generally 338apply to the destination host and not any specified jump hosts. 339Use 340.Pa ~/.ssh/config 341to specify configuration for jump hosts. 342.Pp 343.It Fl K 344Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI 345credentials to the server. 346.Pp 347.It Fl k 348Disables forwarding (delegation) of GSSAPI credentials to the server. 349.Pp 350.It Fl L Xo 351.Sm off 352.Oo Ar bind_address : Oc 353.Ar port : host : hostport 354.Sm on 355.Xc 356.It Fl L Xo 357.Sm off 358.Oo Ar bind_address : Oc 359.Ar port : remote_socket 360.Sm on 361.Xc 362.It Fl L Xo 363.Sm off 364.Ar local_socket : host : hostport 365.Sm on 366.Xc 367.It Fl L Xo 368.Sm off 369.Ar local_socket : remote_socket 370.Sm on 371.Xc 372Specifies that connections to the given TCP port or Unix socket on the local 373(client) host are to be forwarded to the given host and port, or Unix socket, 374on the remote side. 375This works by allocating a socket to listen to either a TCP 376.Ar port 377on the local side, optionally bound to the specified 378.Ar bind_address , 379or to a Unix socket. 380Whenever a connection is made to the local port or socket, the 381connection is forwarded over the secure channel, and a connection is 382made to either 383.Ar host 384port 385.Ar hostport , 386or the Unix socket 387.Ar remote_socket , 388from the remote machine. 389.Pp 390Port forwardings can also be specified in the configuration file. 391Only the superuser can forward privileged ports. 392IPv6 addresses can be specified by enclosing the address in square brackets. 393.Pp 394By default, the local port is bound in accordance with the 395.Cm GatewayPorts 396setting. 397However, an explicit 398.Ar bind_address 399may be used to bind the connection to a specific address. 400The 401.Ar bind_address 402of 403.Dq localhost 404indicates that the listening port be bound for local use only, while an 405empty address or 406.Sq * 407indicates that the port should be available from all interfaces. 408.Pp 409.It Fl l Ar login_name 410Specifies the user to log in as on the remote machine. 411This also may be specified on a per-host basis in the configuration file. 412.Pp 413.It Fl M 414Places the 415.Nm 416client into 417.Dq master 418mode for connection sharing. 419Multiple 420.Fl M 421options places 422.Nm 423into 424.Dq master 425mode but with confirmation required using 426.Xr ssh-askpass 1 427before each operation that changes the multiplexing state 428(e.g. opening a new session). 429Refer to the description of 430.Cm ControlMaster 431in 432.Xr ssh_config 5 433for details. 434.Pp 435.It Fl m Ar mac_spec 436A comma-separated list of MAC (message authentication code) algorithms, 437specified in order of preference. 438See the 439.Cm MACs 440keyword in 441.Xr ssh_config 5 442for more information. 443.Pp 444.It Fl N 445Do not execute a remote command. 446This is useful for just forwarding ports. 447Refer to the description of 448.Cm SessionType 449in 450.Xr ssh_config 5 451for details. 452.Pp 453.It Fl n 454Redirects stdin from 455.Pa /dev/null 456(actually, prevents reading from stdin). 457This must be used when 458.Nm 459is run in the background. 460A common trick is to use this to run X11 programs on a remote machine. 461For example, 462.Ic ssh -n shadows.cs.hut.fi emacs & 463will start an emacs on shadows.cs.hut.fi, and the X11 464connection will be automatically forwarded over an encrypted channel. 465The 466.Nm 467program will be put in the background. 468(This does not work if 469.Nm 470needs to ask for a password or passphrase; see also the 471.Fl f 472option.) 473Refer to the description of 474.Cm StdinNull 475in 476.Xr ssh_config 5 477for details. 478.Pp 479.It Fl O Ar ctl_cmd 480Control an active connection multiplexing master process. 481When the 482.Fl O 483option is specified, the 484.Ar ctl_cmd 485argument is interpreted and passed to the master process. 486Valid commands are: 487.Dq check 488(check that the master process is running), 489.Dq conninfo 490(report information about the master connection), 491.Dq channels 492(report information about open channels), 493.Dq forward 494(request forwardings without command execution), 495.Dq cancel 496(cancel forwardings), 497.Dq proxy 498(connect to a running multiplexing master in proxy mode), 499.Dq exit 500(request the master to exit), and 501.Dq stop 502(request the master to stop accepting further multiplexing requests). 503.Pp 504.It Fl o Ar option 505Can be used to give options in the format used in the configuration file. 506This is useful for specifying options for which there is no separate 507command-line flag. 508For full details of the options listed below, and their possible values, see 509.Xr ssh_config 5 . 510.Pp 511.Bl -tag -width Ds -offset indent -compact 512.It AddKeysToAgent 513.It AddressFamily 514.It BatchMode 515.It BindAddress 516.It BindInterface 517.It CASignatureAlgorithms 518.It CanonicalDomains 519.It CanonicalizeFallbackLocal 520.It CanonicalizeHostname 521.It CanonicalizeMaxDots 522.It CanonicalizePermittedCNAMEs 523.It CertificateFile 524.It ChannelTimeout 525.It CheckHostIP 526.It Ciphers 527.It ClearAllForwardings 528.It Compression 529.It ConnectTimeout 530.It ConnectionAttempts 531.It ControlMaster 532.It ControlPath 533.It ControlPersist 534.It DynamicForward 535.It EnableEscapeCommandline 536.It EnableSSHKeysign 537.It EscapeChar 538.It ExitOnForwardFailure 539.It FingerprintHash 540.It ForkAfterAuthentication 541.It ForwardAgent 542.It ForwardX11 543.It ForwardX11Timeout 544.It ForwardX11Trusted 545.It GSSAPIAuthentication 546.It GSSAPIDelegateCredentials 547.It GatewayPorts 548.It GlobalKnownHostsFile 549.It HashKnownHosts 550.It Host 551.It HostKeyAlgorithms 552.It HostKeyAlias 553.It HostbasedAcceptedAlgorithms 554.It HostbasedAuthentication 555.It Hostname 556.It IPQoS 557.It IdentitiesOnly 558.It IdentityAgent 559.It IdentityFile 560.It IgnoreUnknown 561.It Include 562.It KbdInteractiveAuthentication 563.It KbdInteractiveDevices 564.It KexAlgorithms 565.It KnownHostsCommand 566.It LocalCommand 567.It LocalForward 568.It LogLevel 569.It LogVerbose 570.It MACs 571.It NoHostAuthenticationForLocalhost 572.It NumberOfPasswordPrompts 573.It ObscureKeystrokeTiming 574.It PKCS11Provider 575.It PasswordAuthentication 576.It PermitLocalCommand 577.It PermitRemoteOpen 578.It Port 579.It PreferredAuthentications 580.It ProxyCommand 581.It ProxyJump 582.It ProxyUseFdpass 583.It PubkeyAcceptedAlgorithms 584.It PubkeyAuthentication 585.It RekeyLimit 586.It RemoteCommand 587.It RemoteForward 588.It RequestTTY 589.It RequiredRSASize 590.It RevokedHostKeys 591.It SecurityKeyProvider 592.It SendEnv 593.It ServerAliveCountMax 594.It ServerAliveInterval 595.It SessionType 596.It SetEnv 597.It StdinNull 598.It StreamLocalBindMask 599.It StreamLocalBindUnlink 600.It StrictHostKeyChecking 601.It SyslogFacility 602.It TCPKeepAlive 603.It Tag 604.It Tunnel 605.It TunnelDevice 606.It UpdateHostKeys 607.It User 608.It UserKnownHostsFile 609.It VerifyHostKeyDNS 610.It VisualHostKey 611.It XAuthLocation 612.El 613.Pp 614.It Fl P Ar tag 615Specify a tag name that may be used to select configuration in 616.Xr ssh_config 5 . 617Refer to the 618.Cm Tag 619and 620.Cm Match 621keywords in 622.Xr ssh_config 5 623for more information. 624.It Fl p Ar port 625Port to connect to on the remote host. 626This can be specified on a 627per-host basis in the configuration file. 628.Pp 629.It Fl Q Ar query_option 630Queries for the algorithms supported by one of the following features: 631.Ar cipher 632(supported symmetric ciphers), 633.Ar cipher-auth 634(supported symmetric ciphers that support authenticated encryption), 635.Ar help 636(supported query terms for use with the 637.Fl Q 638flag), 639.Ar mac 640(supported message integrity codes), 641.Ar kex 642(key exchange algorithms), 643.Ar key 644(key types), 645.Ar key-ca-sign 646(valid CA signature algorithms for certificates), 647.Ar key-cert 648(certificate key types), 649.Ar key-plain 650(non-certificate key types), 651.Ar key-sig 652(all key types and signature algorithms), 653.Ar protocol-version 654(supported SSH protocol versions), and 655.Ar sig 656(supported signature algorithms). 657Alternatively, any keyword from 658.Xr ssh_config 5 659or 660.Xr sshd_config 5 661that takes an algorithm list may be used as an alias for the corresponding 662query_option. 663.Pp 664.It Fl q 665Quiet mode. 666Causes most warning and diagnostic messages to be suppressed. 667.Pp 668.It Fl R Xo 669.Sm off 670.Oo Ar bind_address : Oc 671.Ar port : host : hostport 672.Sm on 673.Xc 674.It Fl R Xo 675.Sm off 676.Oo Ar bind_address : Oc 677.Ar port : local_socket 678.Sm on 679.Xc 680.It Fl R Xo 681.Sm off 682.Ar remote_socket : host : hostport 683.Sm on 684.Xc 685.It Fl R Xo 686.Sm off 687.Ar remote_socket : local_socket 688.Sm on 689.Xc 690.It Fl R Xo 691.Sm off 692.Oo Ar bind_address : Oc 693.Ar port 694.Sm on 695.Xc 696Specifies that connections to the given TCP port or Unix socket on the remote 697(server) host are to be forwarded to the local side. 698.Pp 699This works by allocating a socket to listen to either a TCP 700.Ar port 701or to a Unix socket on the remote side. 702Whenever a connection is made to this port or Unix socket, the 703connection is forwarded over the secure channel, and a connection 704is made from the local machine to either an explicit destination specified by 705.Ar host 706port 707.Ar hostport , 708or 709.Ar local_socket , 710or, if no explicit destination was specified, 711.Nm 712will act as a SOCKS 4/5 proxy and forward connections to the destinations 713requested by the remote SOCKS client. 714.Pp 715Port forwardings can also be specified in the configuration file. 716Privileged ports can be forwarded only when 717logging in as root on the remote machine. 718IPv6 addresses can be specified by enclosing the address in square brackets. 719.Pp 720By default, TCP listening sockets on the server will be bound to the loopback 721interface only. 722This may be overridden by specifying a 723.Ar bind_address . 724An empty 725.Ar bind_address , 726or the address 727.Ql * , 728indicates that the remote socket should listen on all interfaces. 729Specifying a remote 730.Ar bind_address 731will only succeed if the server's 732.Cm GatewayPorts 733option is enabled (see 734.Xr sshd_config 5 ) . 735.Pp 736If the 737.Ar port 738argument is 739.Ql 0 , 740the listen port will be dynamically allocated on the server and reported 741to the client at run time. 742When used together with 743.Ic -O forward , 744the allocated port will be printed to the standard output. 745.Pp 746.It Fl S Ar ctl_path 747Specifies the location of a control socket for connection sharing, 748or the string 749.Dq none 750to disable connection sharing. 751Refer to the description of 752.Cm ControlPath 753and 754.Cm ControlMaster 755in 756.Xr ssh_config 5 757for details. 758.Pp 759.It Fl s 760May be used to request invocation of a subsystem on the remote system. 761Subsystems facilitate the use of SSH 762as a secure transport for other applications (e.g.\& 763.Xr sftp 1 ) . 764The subsystem is specified as the remote command. 765Refer to the description of 766.Cm SessionType 767in 768.Xr ssh_config 5 769for details. 770.Pp 771.It Fl T 772Disable pseudo-terminal allocation. 773.Pp 774.It Fl t 775Force pseudo-terminal allocation. 776This can be used to execute arbitrary 777screen-based programs on a remote machine, which can be very useful, 778e.g. when implementing menu services. 779Multiple 780.Fl t 781options force tty allocation, even if 782.Nm 783has no local tty. 784.Pp 785.It Fl V 786Display the version number and exit. 787.Pp 788.It Fl v 789Verbose mode. 790Causes 791.Nm 792to print debugging messages about its progress. 793This is helpful in 794debugging connection, authentication, and configuration problems. 795Multiple 796.Fl v 797options increase the verbosity. 798The maximum is 3. 799.Pp 800.It Fl W Ar host : Ns Ar port 801Requests that standard input and output on the client be forwarded to 802.Ar host 803on 804.Ar port 805over the secure channel. 806Implies 807.Fl N , 808.Fl T , 809.Cm ExitOnForwardFailure 810and 811.Cm ClearAllForwardings , 812though these can be overridden in the configuration file or using 813.Fl o 814command line options. 815.Pp 816.It Fl w Xo 817.Ar local_tun Ns Op : Ns Ar remote_tun 818.Xc 819Requests 820tunnel 821device forwarding with the specified 822.Xr tun 4 823devices between the client 824.Pq Ar local_tun 825and the server 826.Pq Ar remote_tun . 827.Pp 828The devices may be specified by numerical ID or the keyword 829.Dq any , 830which uses the next available tunnel device. 831If 832.Ar remote_tun 833is not specified, it defaults to 834.Dq any . 835See also the 836.Cm Tunnel 837and 838.Cm TunnelDevice 839directives in 840.Xr ssh_config 5 . 841.Pp 842If the 843.Cm Tunnel 844directive is unset, it will be set to the default tunnel mode, which is 845.Dq point-to-point . 846If a different 847.Cm Tunnel 848forwarding mode it desired, then it should be specified before 849.Fl w . 850.Pp 851.It Fl X 852Enables X11 forwarding. 853This can also be specified on a per-host basis in a configuration file. 854.Pp 855X11 forwarding should be enabled with caution. 856Users with the ability to bypass file permissions on the remote host 857(for the user's X authorization database) 858can access the local X11 display through the forwarded connection. 859An attacker may then be able to perform activities such as keystroke monitoring. 860.Pp 861For this reason, X11 forwarding is subjected to X11 SECURITY extension 862restrictions by default. 863Refer to the 864.Nm 865.Fl Y 866option and the 867.Cm ForwardX11Trusted 868directive in 869.Xr ssh_config 5 870for more information. 871.Pp 872.It Fl x 873Disables X11 forwarding. 874.Pp 875.It Fl Y 876Enables trusted X11 forwarding. 877Trusted X11 forwardings are not subjected to the X11 SECURITY extension 878controls. 879.Pp 880.It Fl y 881Send log information using the 882.Xr syslog 3 883system module. 884By default this information is sent to stderr. 885.El 886.Pp 887.Nm 888may additionally obtain configuration data from 889a per-user configuration file and a system-wide configuration file. 890The file format and configuration options are described in 891.Xr ssh_config 5 . 892.Sh AUTHENTICATION 893The OpenSSH SSH client supports SSH protocol 2. 894.Pp 895The methods available for authentication are: 896GSSAPI-based authentication, 897host-based authentication, 898public key authentication, 899keyboard-interactive authentication, 900and password authentication. 901Authentication methods are tried in the order specified above, 902though 903.Cm PreferredAuthentications 904can be used to change the default order. 905.Pp 906Host-based authentication works as follows: 907If the machine the user logs in from is listed in 908.Pa /etc/hosts.equiv 909or 910.Pa /etc/shosts.equiv 911on the remote machine, the user is non-root and the user names are 912the same on both sides, or if the files 913.Pa ~/.rhosts 914or 915.Pa ~/.shosts 916exist in the user's home directory on the 917remote machine and contain a line containing the name of the client 918machine and the name of the user on that machine, the user is 919considered for login. 920Additionally, the server 921.Em must 922be able to verify the client's 923host key (see the description of 924.Pa /etc/ssh/ssh_known_hosts 925and 926.Pa ~/.ssh/known_hosts , 927below) 928for login to be permitted. 929This authentication method closes security holes due to IP 930spoofing, DNS spoofing, and routing spoofing. 931[Note to the administrator: 932.Pa /etc/hosts.equiv , 933.Pa ~/.rhosts , 934and the rlogin/rsh protocol in general, are inherently insecure and should be 935disabled if security is desired.] 936.Pp 937Public key authentication works as follows: 938The scheme is based on public-key cryptography, 939using cryptosystems 940where encryption and decryption are done using separate keys, 941and it is unfeasible to derive the decryption key from the encryption key. 942The idea is that each user creates a public/private 943key pair for authentication purposes. 944The server knows the public key, and only the user knows the private key. 945.Nm 946implements public key authentication protocol automatically, 947using one of the ECDSA, Ed25519 or RSA algorithms. 948.Pp 949The file 950.Pa ~/.ssh/authorized_keys 951lists the public keys that are permitted for logging in. 952When the user logs in, the 953.Nm 954program tells the server which key pair it would like to use for 955authentication. 956The client proves that it has access to the private key 957and the server checks that the corresponding public key 958is authorized to accept the account. 959.Pp 960The server may inform the client of errors that prevented public key 961authentication from succeeding after authentication completes using a 962different method. 963These may be viewed by increasing the 964.Cm LogLevel 965to 966.Cm DEBUG 967or higher (e.g. by using the 968.Fl v 969flag). 970.Pp 971The user creates their key pair by running 972.Xr ssh-keygen 1 . 973This stores the private key in 974.Pa ~/.ssh/id_ecdsa 975(ECDSA), 976.Pa ~/.ssh/id_ecdsa_sk 977(authenticator-hosted ECDSA), 978.Pa ~/.ssh/id_ed25519 979(Ed25519), 980.Pa ~/.ssh/id_ed25519_sk 981(authenticator-hosted Ed25519), 982or 983.Pa ~/.ssh/id_rsa 984(RSA) 985and stores the public key in 986.Pa ~/.ssh/id_ecdsa.pub 987(ECDSA), 988.Pa ~/.ssh/id_ecdsa_sk.pub 989(authenticator-hosted ECDSA), 990.Pa ~/.ssh/id_ed25519.pub 991(Ed25519), 992.Pa ~/.ssh/id_ed25519_sk.pub 993(authenticator-hosted Ed25519), 994or 995.Pa ~/.ssh/id_rsa.pub 996(RSA) 997in the user's home directory. 998The user should then copy the public key 999to 1000.Pa ~/.ssh/authorized_keys 1001in their home directory on the remote machine. 1002The 1003.Pa authorized_keys 1004file corresponds to the conventional 1005.Pa ~/.rhosts 1006file, and has one key 1007per line, though the lines can be very long. 1008After this, the user can log in without giving the password. 1009.Pp 1010A variation on public key authentication 1011is available in the form of certificate authentication: 1012instead of a set of public/private keys, 1013signed certificates are used. 1014This has the advantage that a single trusted certification authority 1015can be used in place of many public/private keys. 1016See the CERTIFICATES section of 1017.Xr ssh-keygen 1 1018for more information. 1019.Pp 1020The most convenient way to use public key or certificate authentication 1021may be with an authentication agent. 1022See 1023.Xr ssh-agent 1 1024and (optionally) the 1025.Cm AddKeysToAgent 1026directive in 1027.Xr ssh_config 5 1028for more information. 1029.Pp 1030Keyboard-interactive authentication works as follows: 1031The server sends an arbitrary 1032.Qq challenge 1033text and prompts for a response, possibly multiple times. 1034Examples of keyboard-interactive authentication include 1035.Bx 1036Authentication (see 1037.Xr login.conf 5 ) 1038and PAM (some 1039.Pf non- Ox 1040systems). 1041.Pp 1042Finally, if other authentication methods fail, 1043.Nm 1044prompts the user for a password. 1045The password is sent to the remote 1046host for checking; however, since all communications are encrypted, 1047the password cannot be seen by someone listening on the network. 1048.Pp 1049.Nm 1050automatically maintains and checks a database containing 1051identification for all hosts it has ever been used with. 1052Host keys are stored in 1053.Pa ~/.ssh/known_hosts 1054in the user's home directory. 1055Additionally, the file 1056.Pa /etc/ssh/ssh_known_hosts 1057is automatically checked for known hosts. 1058Any new hosts are automatically added to the user's file. 1059If a host's identification ever changes, 1060.Nm 1061warns about this and disables password authentication to prevent 1062server spoofing or man-in-the-middle attacks, 1063which could otherwise be used to circumvent the encryption. 1064The 1065.Cm StrictHostKeyChecking 1066option can be used to control logins to machines whose 1067host key is not known or has changed. 1068.Pp 1069When the user's identity has been accepted by the server, the server 1070either executes the given command in a non-interactive session or, 1071if no command has been specified, logs into the machine and gives 1072the user a normal shell as an interactive session. 1073All communication with 1074the remote command or shell will be automatically encrypted. 1075.Pp 1076If an interactive session is requested, 1077.Nm 1078by default will only request a pseudo-terminal (pty) for interactive 1079sessions when the client has one. 1080The flags 1081.Fl T 1082and 1083.Fl t 1084can be used to override this behaviour. 1085.Pp 1086If a pseudo-terminal has been allocated, the 1087user may use the escape characters noted below. 1088.Pp 1089If no pseudo-terminal has been allocated, 1090the session is transparent and can be used to reliably transfer binary data. 1091On most systems, setting the escape character to 1092.Dq none 1093will also make the session transparent even if a tty is used. 1094.Pp 1095The session terminates when the command or shell on the remote 1096machine exits and all X11 and TCP connections have been closed. 1097.Sh ESCAPE CHARACTERS 1098When a pseudo-terminal has been requested, 1099.Nm 1100supports a number of functions through the use of an escape character. 1101.Pp 1102A single tilde character can be sent as 1103.Ic ~~ 1104or by following the tilde by a character other than those described below. 1105The escape character must always follow a newline to be interpreted as 1106special. 1107The escape character can be changed in configuration files using the 1108.Cm EscapeChar 1109configuration directive or on the command line by the 1110.Fl e 1111option. 1112.Pp 1113The supported escapes (assuming the default 1114.Ql ~ ) 1115are: 1116.Bl -tag -width Ds 1117.It Cm ~. 1118Disconnect. 1119.It Cm ~^Z 1120Background 1121.Nm . 1122.It Cm ~# 1123List forwarded connections. 1124.It Cm ~& 1125Background 1126.Nm 1127at logout when waiting for forwarded connection / X11 sessions to terminate. 1128.It Cm ~? 1129Display a list of escape characters. 1130.It Cm ~B 1131Send a BREAK to the remote system 1132(only useful if the peer supports it). 1133.It Cm ~C 1134Open command line. 1135Currently this allows the addition of port forwardings using the 1136.Fl L , 1137.Fl R 1138and 1139.Fl D 1140options (see above). 1141It also allows the cancellation of existing port-forwardings 1142with 1143.Sm off 1144.Fl KL Oo Ar bind_address : Oc Ar port 1145.Sm on 1146for local, 1147.Sm off 1148.Fl KR Oo Ar bind_address : Oc Ar port 1149.Sm on 1150for remote and 1151.Sm off 1152.Fl KD Oo Ar bind_address : Oc Ar port 1153.Sm on 1154for dynamic port-forwardings. 1155.Ic !\& Ns Ar command 1156allows the user to execute a local command if the 1157.Ic PermitLocalCommand 1158option is enabled in 1159.Xr ssh_config 5 . 1160Basic help is available, using the 1161.Fl h 1162option. 1163.It Cm ~I 1164Show information about the current SSH connection. 1165.It Cm ~R 1166Request rekeying of the connection 1167(only useful if the peer supports it). 1168.It Cm ~V 1169Decrease the verbosity 1170.Pq Ic LogLevel 1171when errors are being written to stderr. 1172.It Cm ~v 1173Increase the verbosity 1174.Pq Ic LogLevel 1175when errors are being written to stderr. 1176.El 1177.Sh TCP FORWARDING 1178Forwarding of arbitrary TCP connections over a secure channel 1179can be specified either on the command line or in a configuration file. 1180One possible application of TCP forwarding is a secure connection to a 1181mail server; another is going through firewalls. 1182.Pp 1183In the example below, we look at encrypting communication for an IRC client, 1184even though the IRC server it connects to does not directly 1185support encrypted communication. 1186This works as follows: 1187the user connects to the remote host using 1188.Nm , 1189specifying the ports to be used to forward the connection. 1190After that it is possible to start the program locally, 1191and 1192.Nm 1193will encrypt and forward the connection to the remote server. 1194.Pp 1195The following example tunnels an IRC session from the client 1196to an IRC server at 1197.Dq server.example.com , 1198joining channel 1199.Dq #users , 1200nickname 1201.Dq pinky , 1202using the standard IRC port, 6667: 1203.Bd -literal -offset 4n 1204$ ssh -f -L 6667:localhost:6667 server.example.com sleep 10 1205$ irc -c '#users' pinky IRC/127.0.0.1 1206.Ed 1207.Pp 1208The 1209.Fl f 1210option backgrounds 1211.Nm 1212and the remote command 1213.Dq sleep 10 1214is specified to allow an amount of time 1215(10 seconds, in the example) 1216to start the program which is going to use the tunnel. 1217If no connections are made within the time specified, 1218.Nm 1219will exit. 1220.Sh X11 FORWARDING 1221If the 1222.Cm ForwardX11 1223variable is set to 1224.Dq yes 1225(or see the description of the 1226.Fl X , 1227.Fl x , 1228and 1229.Fl Y 1230options above) 1231and the user is using X11 (the 1232.Ev DISPLAY 1233environment variable is set), the connection to the X11 display is 1234automatically forwarded to the remote side in such a way that any X11 1235programs started from the shell (or command) will go through the 1236encrypted channel, and the connection to the real X server will be made 1237from the local machine. 1238The user should not manually set 1239.Ev DISPLAY . 1240Forwarding of X11 connections can be 1241configured on the command line or in configuration files. 1242.Pp 1243The 1244.Ev DISPLAY 1245value set by 1246.Nm 1247will point to the server machine, but with a display number greater than zero. 1248This is normal, and happens because 1249.Nm 1250creates a 1251.Dq proxy 1252X server on the server machine for forwarding the 1253connections over the encrypted channel. 1254.Pp 1255.Nm 1256will also automatically set up Xauthority data on the server machine. 1257For this purpose, it will generate a random authorization cookie, 1258store it in Xauthority on the server, and verify that any forwarded 1259connections carry this cookie and replace it by the real cookie when 1260the connection is opened. 1261The real authentication cookie is never 1262sent to the server machine (and no cookies are sent in the plain). 1263.Pp 1264If the 1265.Cm ForwardAgent 1266variable is set to 1267.Dq yes 1268(or see the description of the 1269.Fl A 1270and 1271.Fl a 1272options above) and 1273the user is using an authentication agent, the connection to the agent 1274is automatically forwarded to the remote side. 1275.Sh VERIFYING HOST KEYS 1276When connecting to a server for the first time, 1277a fingerprint of the server's public key is presented to the user 1278(unless the option 1279.Cm StrictHostKeyChecking 1280has been disabled). 1281Fingerprints can be determined using 1282.Xr ssh-keygen 1 : 1283.Pp 1284.Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key 1285.Pp 1286If the fingerprint is already known, it can be matched 1287and the key can be accepted or rejected. 1288If only legacy (MD5) fingerprints for the server are available, the 1289.Xr ssh-keygen 1 1290.Fl E 1291option may be used to downgrade the fingerprint algorithm to match. 1292.Pp 1293Because of the difficulty of comparing host keys 1294just by looking at fingerprint strings, 1295there is also support to compare host keys visually, 1296using 1297.Em random art . 1298By setting the 1299.Cm VisualHostKey 1300option to 1301.Dq yes , 1302a small ASCII graphic gets displayed on every login to a server, no matter 1303if the session itself is interactive or not. 1304By learning the pattern a known server produces, a user can easily 1305find out that the host key has changed when a completely different pattern 1306is displayed. 1307Because these patterns are not unambiguous however, a pattern that looks 1308similar to the pattern remembered only gives a good probability that the 1309host key is the same, not guaranteed proof. 1310.Pp 1311To get a listing of the fingerprints along with their random art for 1312all known hosts, the following command line can be used: 1313.Pp 1314.Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts 1315.Pp 1316If the fingerprint is unknown, 1317an alternative method of verification is available: 1318SSH fingerprints verified by DNS. 1319An additional resource record (RR), 1320SSHFP, 1321is added to a zonefile 1322and the connecting client is able to match the fingerprint 1323with that of the key presented. 1324.Pp 1325In this example, we are connecting a client to a server, 1326.Dq host.example.com . 1327The SSHFP resource records should first be added to the zonefile for 1328host.example.com: 1329.Bd -literal -offset indent 1330$ ssh-keygen -r host.example.com. 1331.Ed 1332.Pp 1333The output lines will have to be added to the zonefile. 1334To check that the zone is answering fingerprint queries: 1335.Pp 1336.Dl $ dig -t SSHFP host.example.com 1337.Pp 1338Finally the client connects: 1339.Bd -literal -offset indent 1340$ ssh -o "VerifyHostKeyDNS ask" host.example.com 1341[...] 1342Matching host key fingerprint found in DNS. 1343Are you sure you want to continue connecting (yes/no)? 1344.Ed 1345.Pp 1346See the 1347.Cm VerifyHostKeyDNS 1348option in 1349.Xr ssh_config 5 1350for more information. 1351.Sh SSH-BASED VIRTUAL PRIVATE NETWORKS 1352.Nm 1353contains support for Virtual Private Network (VPN) tunnelling 1354using the 1355.Xr tun 4 1356network pseudo-device, 1357allowing two networks to be joined securely. 1358The 1359.Xr sshd_config 5 1360configuration option 1361.Cm PermitTunnel 1362controls whether the server supports this, 1363and at what level (layer 2 or 3 traffic). 1364.Pp 1365The following example would connect client network 10.0.50.0/24 1366with remote network 10.0.99.0/24 using a point-to-point connection 1367from 10.1.1.1 to 10.1.1.2, 1368provided that the SSH server running on the gateway to the remote network, 1369at 192.168.1.15, allows it. 1370.Pp 1371On the client: 1372.Bd -literal -offset indent 1373# ssh -f -w 0:1 192.168.1.15 true 1374# ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252 1375# route add 10.0.99.0/24 10.1.1.2 1376.Ed 1377.Pp 1378On the server: 1379.Bd -literal -offset indent 1380# ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252 1381# route add 10.0.50.0/24 10.1.1.1 1382.Ed 1383.Pp 1384Client access may be more finely tuned via the 1385.Pa /root/.ssh/authorized_keys 1386file (see below) and the 1387.Cm PermitRootLogin 1388server option. 1389The following entry would permit connections on 1390.Xr tun 4 1391device 1 from user 1392.Dq jane 1393and on tun device 2 from user 1394.Dq john , 1395if 1396.Cm PermitRootLogin 1397is set to 1398.Dq forced-commands-only : 1399.Bd -literal -offset 2n 1400tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane 1401tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john 1402.Ed 1403.Pp 1404Since an SSH-based setup entails a fair amount of overhead, 1405it may be more suited to temporary setups, 1406such as for wireless VPNs. 1407More permanent VPNs are better provided by tools such as 1408.Xr ipsecctl 8 1409and 1410.Xr isakmpd 8 . 1411.Sh ENVIRONMENT 1412.Nm 1413will normally set the following environment variables: 1414.Bl -tag -width "SSH_ORIGINAL_COMMAND" 1415.It Ev DISPLAY 1416The 1417.Ev DISPLAY 1418variable indicates the location of the X11 server. 1419It is automatically set by 1420.Nm 1421to point to a value of the form 1422.Dq hostname:n , 1423where 1424.Dq hostname 1425indicates the host where the shell runs, and 1426.Sq n 1427is an integer \*(Ge 1. 1428.Nm 1429uses this special value to forward X11 connections over the secure 1430channel. 1431The user should normally not set 1432.Ev DISPLAY 1433explicitly, as that 1434will render the X11 connection insecure (and will require the user to 1435manually copy any required authorization cookies). 1436.It Ev HOME 1437Set to the path of the user's home directory. 1438.It Ev LOGNAME 1439Synonym for 1440.Ev USER ; 1441set for compatibility with systems that use this variable. 1442.It Ev MAIL 1443Set to the path of the user's mailbox. 1444.It Ev PATH 1445Set to the default 1446.Ev PATH , 1447as specified when compiling 1448.Nm . 1449.It Ev SSH_ASKPASS 1450If 1451.Nm 1452needs a passphrase, it will read the passphrase from the current 1453terminal if it was run from a terminal. 1454If 1455.Nm 1456does not have a terminal associated with it but 1457.Ev DISPLAY 1458and 1459.Ev SSH_ASKPASS 1460are set, it will execute the program specified by 1461.Ev SSH_ASKPASS 1462and open an X11 window to read the passphrase. 1463This is particularly useful when calling 1464.Nm 1465from a 1466.Pa .xsession 1467or related script. 1468(Note that on some machines it 1469may be necessary to redirect the input from 1470.Pa /dev/null 1471to make this work.) 1472.It Ev SSH_ASKPASS_REQUIRE 1473Allows further control over the use of an askpass program. 1474If this variable is set to 1475.Dq never 1476then 1477.Nm 1478will never attempt to use one. 1479If it is set to 1480.Dq prefer , 1481then 1482.Nm 1483will prefer to use the askpass program instead of the TTY when requesting 1484passwords. 1485Finally, if the variable is set to 1486.Dq force , 1487then the askpass program will be used for all passphrase input regardless 1488of whether 1489.Ev DISPLAY 1490is set. 1491.It Ev SSH_AUTH_SOCK 1492Identifies the path of a 1493.Ux Ns -domain 1494socket used to communicate with the agent. 1495.It Ev SSH_CONNECTION 1496Identifies the client and server ends of the connection. 1497The variable contains 1498four space-separated values: client IP address, client port number, 1499server IP address, and server port number. 1500.It Ev SSH_ORIGINAL_COMMAND 1501This variable contains the original command line if a forced command 1502is executed. 1503It can be used to extract the original arguments. 1504.It Ev SSH_TTY 1505This is set to the name of the tty (path to the device) associated 1506with the current shell or command. 1507If the current session has no tty, 1508this variable is not set. 1509.It Ev SSH_TUNNEL 1510Optionally set by 1511.Xr sshd 8 1512to contain the interface names assigned if tunnel forwarding was 1513requested by the client. 1514.It Ev SSH_USER_AUTH 1515Optionally set by 1516.Xr sshd 8 , 1517this variable may contain a pathname to a file that lists the authentication 1518methods successfully used when the session was established, including any 1519public keys that were used. 1520.It Ev TZ 1521This variable is set to indicate the present time zone if it 1522was set when the daemon was started (i.e. the daemon passes the value 1523on to new connections). 1524.It Ev USER 1525Set to the name of the user logging in. 1526.El 1527.Pp 1528Additionally, 1529.Nm 1530reads 1531.Pa ~/.ssh/environment , 1532and adds lines of the format 1533.Dq VARNAME=value 1534to the environment if the file exists and users are allowed to 1535change their environment. 1536For more information, see the 1537.Cm PermitUserEnvironment 1538option in 1539.Xr sshd_config 5 . 1540.Sh FILES 1541.Bl -tag -width Ds -compact 1542.It Pa ~/.rhosts 1543This file is used for host-based authentication (see above). 1544On some machines this file may need to be 1545world-readable if the user's home directory is on an NFS partition, 1546because 1547.Xr sshd 8 1548reads it as root. 1549Additionally, this file must be owned by the user, 1550and must not have write permissions for anyone else. 1551The recommended 1552permission for most machines is read/write for the user, and not 1553accessible by others. 1554.Pp 1555.It Pa ~/.shosts 1556This file is used in exactly the same way as 1557.Pa .rhosts , 1558but allows host-based authentication without permitting login with 1559rlogin/rsh. 1560.Pp 1561.It Pa ~/.ssh/ 1562This directory is the default location for all user-specific configuration 1563and authentication information. 1564There is no general requirement to keep the entire contents of this directory 1565secret, but the recommended permissions are read/write/execute for the user, 1566and not accessible by others. 1567.Pp 1568.It Pa ~/.ssh/authorized_keys 1569Lists the public keys (ECDSA, Ed25519, RSA) 1570that can be used for logging in as this user. 1571The format of this file is described in the 1572.Xr sshd 8 1573manual page. 1574This file is not highly sensitive, but the recommended 1575permissions are read/write for the user, and not accessible by others. 1576.Pp 1577.It Pa ~/.ssh/config 1578This is the per-user configuration file. 1579The file format and configuration options are described in 1580.Xr ssh_config 5 . 1581Because of the potential for abuse, this file must have strict permissions: 1582read/write for the user, and not writable by others. 1583.Pp 1584.It Pa ~/.ssh/environment 1585Contains additional definitions for environment variables; see 1586.Sx ENVIRONMENT , 1587above. 1588.Pp 1589.It Pa ~/.ssh/id_ecdsa 1590.It Pa ~/.ssh/id_ecdsa_sk 1591.It Pa ~/.ssh/id_ed25519 1592.It Pa ~/.ssh/id_ed25519_sk 1593.It Pa ~/.ssh/id_rsa 1594Contains the private key for authentication. 1595These files 1596contain sensitive data and should be readable by the user but not 1597accessible by others (read/write/execute). 1598.Nm 1599will simply ignore a private key file if it is accessible by others. 1600It is possible to specify a passphrase when 1601generating the key which will be used to encrypt the 1602sensitive part of this file using AES-128. 1603.Pp 1604.It Pa ~/.ssh/id_ecdsa.pub 1605.It Pa ~/.ssh/id_ecdsa_sk.pub 1606.It Pa ~/.ssh/id_ed25519.pub 1607.It Pa ~/.ssh/id_ed25519_sk.pub 1608.It Pa ~/.ssh/id_rsa.pub 1609Contains the public key for authentication. 1610These files are not 1611sensitive and can (but need not) be readable by anyone. 1612.Pp 1613.It Pa ~/.ssh/known_hosts 1614Contains a list of host keys for all hosts the user has logged into 1615that are not already in the systemwide list of known host keys. 1616See 1617.Xr sshd 8 1618for further details of the format of this file. 1619.Pp 1620.It Pa ~/.ssh/rc 1621Commands in this file are executed by 1622.Nm 1623when the user logs in, just before the user's shell (or command) is 1624started. 1625See the 1626.Xr sshd 8 1627manual page for more information. 1628.Pp 1629.It Pa /etc/hosts.equiv 1630This file is for host-based authentication (see above). 1631It should only be writable by root. 1632.Pp 1633.It Pa /etc/shosts.equiv 1634This file is used in exactly the same way as 1635.Pa hosts.equiv , 1636but allows host-based authentication without permitting login with 1637rlogin/rsh. 1638.Pp 1639.It Pa /etc/ssh/ssh_config 1640Systemwide configuration file. 1641The file format and configuration options are described in 1642.Xr ssh_config 5 . 1643.Pp 1644.It Pa /etc/ssh/ssh_host_ecdsa_key 1645.It Pa /etc/ssh/ssh_host_ed25519_key 1646.It Pa /etc/ssh/ssh_host_rsa_key 1647These files contain the private parts of the host keys 1648and are used for host-based authentication. 1649.Pp 1650.It Pa /etc/ssh/ssh_known_hosts 1651Systemwide list of known host keys. 1652This file should be prepared by the 1653system administrator to contain the public host keys of all machines in the 1654organization. 1655It should be world-readable. 1656See 1657.Xr sshd 8 1658for further details of the format of this file. 1659.Pp 1660.It Pa /etc/ssh/sshrc 1661Commands in this file are executed by 1662.Nm 1663when the user logs in, just before the user's shell (or command) is started. 1664See the 1665.Xr sshd 8 1666manual page for more information. 1667.El 1668.Sh EXIT STATUS 1669.Nm 1670exits with the exit status of the remote command or with 255 1671if an error occurred. 1672.Sh SEE ALSO 1673.Xr scp 1 , 1674.Xr sftp 1 , 1675.Xr ssh-add 1 , 1676.Xr ssh-agent 1 , 1677.Xr ssh-keygen 1 , 1678.Xr ssh-keyscan 1 , 1679.Xr tun 4 , 1680.Xr ssh_config 5 , 1681.Xr ssh-keysign 8 , 1682.Xr sshd 8 1683.Sh STANDARDS 1684.Rs 1685.%A S. Lehtinen 1686.%A C. Lonvick 1687.%D January 2006 1688.%R RFC 4250 1689.%T The Secure Shell (SSH) Protocol Assigned Numbers 1690.Re 1691.Pp 1692.Rs 1693.%A T. Ylonen 1694.%A C. Lonvick 1695.%D January 2006 1696.%R RFC 4251 1697.%T The Secure Shell (SSH) Protocol Architecture 1698.Re 1699.Pp 1700.Rs 1701.%A T. Ylonen 1702.%A C. Lonvick 1703.%D January 2006 1704.%R RFC 4252 1705.%T The Secure Shell (SSH) Authentication Protocol 1706.Re 1707.Pp 1708.Rs 1709.%A T. Ylonen 1710.%A C. Lonvick 1711.%D January 2006 1712.%R RFC 4253 1713.%T The Secure Shell (SSH) Transport Layer Protocol 1714.Re 1715.Pp 1716.Rs 1717.%A T. Ylonen 1718.%A C. Lonvick 1719.%D January 2006 1720.%R RFC 4254 1721.%T The Secure Shell (SSH) Connection Protocol 1722.Re 1723.Pp 1724.Rs 1725.%A J. Schlyter 1726.%A W. Griffin 1727.%D January 2006 1728.%R RFC 4255 1729.%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints 1730.Re 1731.Pp 1732.Rs 1733.%A F. Cusack 1734.%A M. Forssen 1735.%D January 2006 1736.%R RFC 4256 1737.%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH) 1738.Re 1739.Pp 1740.Rs 1741.%A J. Galbraith 1742.%A P. Remaker 1743.%D January 2006 1744.%R RFC 4335 1745.%T The Secure Shell (SSH) Session Channel Break Extension 1746.Re 1747.Pp 1748.Rs 1749.%A M. Bellare 1750.%A T. Kohno 1751.%A C. Namprempre 1752.%D January 2006 1753.%R RFC 4344 1754.%T The Secure Shell (SSH) Transport Layer Encryption Modes 1755.Re 1756.Pp 1757.Rs 1758.%A B. Harris 1759.%D January 2006 1760.%R RFC 4345 1761.%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol 1762.Re 1763.Pp 1764.Rs 1765.%A M. Friedl 1766.%A N. Provos 1767.%A W. Simpson 1768.%D March 2006 1769.%R RFC 4419 1770.%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol 1771.Re 1772.Pp 1773.Rs 1774.%A J. Galbraith 1775.%A R. Thayer 1776.%D November 2006 1777.%R RFC 4716 1778.%T The Secure Shell (SSH) Public Key File Format 1779.Re 1780.Pp 1781.Rs 1782.%A D. Stebila 1783.%A J. Green 1784.%D December 2009 1785.%R RFC 5656 1786.%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer 1787.Re 1788.Pp 1789.Rs 1790.%A A. Perrig 1791.%A D. Song 1792.%D 1999 1793.%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99) 1794.%T Hash Visualization: a New Technique to improve Real-World Security 1795.Re 1796.Sh AUTHORS 1797OpenSSH is a derivative of the original and free 1798ssh 1.2.12 release by Tatu Ylonen. 1799Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 1800Theo de Raadt and Dug Song 1801removed many bugs, re-added newer features and 1802created OpenSSH. 1803Markus Friedl contributed the support for SSH 1804protocol versions 1.5 and 2.0.