1.\" -*- nroff -*- 2.\" 3.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5.\" All rights reserved 6.\" 7.\" As far as I am concerned, the code I have written for this software 8.\" can be used freely for any purpose. Any derived versions of this 9.\" software must be clearly marked as such, and if the derived work is 10.\" incompatible with the protocol description in the RFC file, it must be 11.\" called by a name other than "ssh" or "Secure Shell". 12.\" 13.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. 14.\" Copyright (c) 1999 Aaron Campbell. All rights reserved. 15.\" Copyright (c) 1999 Theo de Raadt. All rights reserved. 16.\" 17.\" Redistribution and use in source and binary forms, with or without 18.\" modification, are permitted provided that the following conditions 19.\" are met: 20.\" 1. Redistributions of source code must retain the above copyright 21.\" notice, this list of conditions and the following disclaimer. 22.\" 2. Redistributions in binary form must reproduce the above copyright 23.\" notice, this list of conditions and the following disclaimer in the 24.\" documentation and/or other materials provided with the distribution. 25.\" 26.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 27.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 28.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 29.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 30.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 31.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36.\" 37.\" $OpenBSD: sshd.8,v 1.184 2002/06/20 19:56:07 stevesk Exp $ 38.\" $FreeBSD$ 39.Dd September 25, 1999 40.Dt SSHD 8 41.Os 42.Sh NAME 43.Nm sshd 44.Nd OpenSSH SSH daemon 45.Sh SYNOPSIS 46.Nm sshd 47.Op Fl deiqtD46 48.Op Fl b Ar bits 49.Op Fl f Ar config_file 50.Op Fl g Ar login_grace_time 51.Op Fl h Ar host_key_file 52.Op Fl k Ar key_gen_time 53.Op Fl o Ar option 54.Op Fl p Ar port 55.Op Fl u Ar len 56.Sh DESCRIPTION 57.Nm 58(SSH Daemon) is the daemon program for 59.Xr ssh 1 . 60Together these programs replace rlogin and rsh, and 61provide secure encrypted communications between two untrusted hosts 62over an insecure network. 63The programs are intended to be as easy to 64install and use as possible. 65.Pp 66.Nm 67is the daemon that listens for connections from clients. 68It is normally started at boot from 69.Pa /etc/rc.network . 70It forks a new 71daemon for each incoming connection. 72The forked daemons handle 73key exchange, encryption, authentication, command execution, 74and data exchange. 75This implementation of 76.Nm 77supports both SSH protocol version 1 and 2 simultaneously. 78.Nm 79works as follows. 80.Pp 81.Ss SSH protocol version 1 82.Pp 83Each host has a host-specific RSA key 84(normally 1024 bits) used to identify the host. 85Additionally, when 86the daemon starts, it generates a server RSA key (normally 768 bits). 87This key is normally regenerated every hour if it has been used, and 88is never stored on disk. 89.Pp 90Whenever a client connects the daemon responds with its public 91host and server keys. 92The client compares the 93RSA host key against its own database to verify that it has not changed. 94The client then generates a 256 bit random number. 95It encrypts this 96random number using both the host key and the server key, and sends 97the encrypted number to the server. 98Both sides then use this 99random number as a session key which is used to encrypt all further 100communications in the session. 101The rest of the session is encrypted 102using a conventional cipher, currently Blowfish or 3DES, with 3DES 103being used by default. 104The client selects the encryption algorithm 105to use from those offered by the server. 106.Pp 107Next, the server and the client enter an authentication dialog. 108The client tries to authenticate itself using 109.Pa .rhosts 110authentication, 111.Pa .rhosts 112authentication combined with RSA host 113authentication, RSA challenge-response authentication, or password 114based authentication. 115.Pp 116Rhosts authentication is normally disabled 117because it is fundamentally insecure, but can be enabled in the server 118configuration file if desired. 119System security is not improved unless 120.Nm rshd , 121.Nm rlogind , 122and 123.Xr rexecd 124are disabled (thus completely disabling 125.Xr rlogin 126and 127.Xr rsh 128into the machine). 129.Pp 130.Ss SSH protocol version 2 131.Pp 132Version 2 works similarly: 133Each host has a host-specific key (RSA or DSA) used to identify the host. 134However, when the daemon starts, it does not generate a server key. 135Forward security is provided through a Diffie-Hellman key agreement. 136This key agreement results in a shared session key. 137.Pp 138The rest of the session is encrypted using a symmetric cipher, currently 139128 bit AES, Blowfish, 3DES, CAST128, Arcfour, 192 bit AES, or 256 bit AES. 140The client selects the encryption algorithm 141to use from those offered by the server. 142Additionally, session integrity is provided 143through a cryptographic message authentication code 144(hmac-sha1 or hmac-md5). 145.Pp 146Protocol version 2 provides a public key based 147user (PubkeyAuthentication) or 148client host (HostbasedAuthentication) authentication method, 149conventional password authentication and challenge response based methods. 150.Pp 151.Ss Command execution and data forwarding 152.Pp 153If the client successfully authenticates itself, a dialog for 154preparing the session is entered. 155At this time the client may request 156things like allocating a pseudo-tty, forwarding X11 connections, 157forwarding TCP/IP connections, or forwarding the authentication agent 158connection over the secure channel. 159.Pp 160Finally, the client either requests a shell or execution of a command. 161The sides then enter session mode. 162In this mode, either side may send 163data at any time, and such data is forwarded to/from the shell or 164command on the server side, and the user terminal in the client side. 165.Pp 166When the user program terminates and all forwarded X11 and other 167connections have been closed, the server sends command exit status to 168the client, and both sides exit. 169.Pp 170.Nm 171can be configured using command-line options or a configuration 172file. 173Command-line options override values specified in the 174configuration file. 175.Pp 176.Nm 177rereads its configuration file when it receives a hangup signal, 178.Dv SIGHUP , 179by executing itself with the name it was started as, i.e., 180.Pa /usr/sbin/sshd . 181.Pp 182The options are as follows: 183.Bl -tag -width Ds 184.It Fl b Ar bits 185Specifies the number of bits in the ephemeral protocol version 1 186server key (default 768). 187.It Fl d 188Debug mode. 189The server sends verbose debug output to the system 190log, and does not put itself in the background. 191The server also will not fork and will only process one connection. 192This option is only intended for debugging for the server. 193Multiple -d options increase the debugging level. 194Maximum is 3. 195.It Fl e 196When this option is specified, 197.Nm 198will send the output to the standard error instead of the system log. 199.It Fl f Ar configuration_file 200Specifies the name of the configuration file. 201The default is 202.Pa /etc/ssh/sshd_config . 203.Nm 204refuses to start if there is no configuration file. 205.It Fl g Ar login_grace_time 206Gives the grace time for clients to authenticate themselves (default 207600 seconds). 208If the client fails to authenticate the user within 209this many seconds, the server disconnects and exits. 210A value of zero indicates no limit. 211.It Fl h Ar host_key_file 212Specifies a file from which a host key is read. 213This option must be given if 214.Nm 215is not run as root (as the normal 216host key files are normally not readable by anyone but root). 217The default is 218.Pa /etc/ssh/ssh_host_key 219for protocol version 1, and 220.Pa /etc/ssh/ssh_host_rsa_key 221and 222.Pa /etc/ssh/ssh_host_dsa_key 223for protocol version 2. 224It is possible to have multiple host key files for 225the different protocol versions and host key algorithms. 226.It Fl i 227Specifies that 228.Nm 229is being run from inetd. 230.Nm 231is normally not run 232from inetd because it needs to generate the server key before it can 233respond to the client, and this may take tens of seconds. 234Clients would have to wait too long if the key was regenerated every time. 235However, with small key sizes (e.g., 512) using 236.Nm 237from inetd may 238be feasible. 239.It Fl k Ar key_gen_time 240Specifies how often the ephemeral protocol version 1 server key is 241regenerated (default 3600 seconds, or one hour). 242The motivation for regenerating the key fairly 243often is that the key is not stored anywhere, and after about an hour, 244it becomes impossible to recover the key for decrypting intercepted 245communications even if the machine is cracked into or physically 246seized. 247A value of zero indicates that the key will never be regenerated. 248.It Fl o Ar option 249Can be used to give options in the format used in the configuration file. 250This is useful for specifying options for which there is no separate 251command-line flag. 252.It Fl p Ar port 253Specifies the port on which the server listens for connections 254(default 22). 255Multiple port options are permitted. 256Ports specified in the configuration file are ignored when a 257command-line port is specified. 258.It Fl q 259Quiet mode. 260Nothing is sent to the system log. 261Normally the beginning, 262authentication, and termination of each connection is logged. 263.It Fl t 264Test mode. 265Only check the validity of the configuration file and sanity of the keys. 266This is useful for updating 267.Nm 268reliably as configuration options may change. 269.It Fl u Ar len 270This option is used to specify the size of the field 271in the 272.Li utmp 273structure that holds the remote host name. 274If the resolved host name is longer than 275.Ar len , 276the dotted decimal value will be used instead. 277This allows hosts with very long host names that 278overflow this field to still be uniquely identified. 279Specifying 280.Fl u0 281indicates that only dotted decimal addresses 282should be put into the 283.Pa utmp 284file. 285.Fl u0 286is also be used to prevent 287.Nm 288from making DNS requests unless the authentication 289mechanism or configuration requires it. 290Authentication mechanisms that may require DNS include 291.Cm RhostsAuthentication , 292.Cm RhostsRSAAuthentication , 293.Cm HostbasedAuthentication 294and using a 295.Cm from="pattern-list" 296option in a key file. 297Configuration options that require DNS include using a 298USER@HOST pattern in 299.Cm AllowUsers 300or 301.Cm DenyUsers . 302.It Fl D 303When this option is specified 304.Nm 305will not detach and does not become a daemon. 306This allows easy monitoring of 307.Nm sshd . 308.It Fl 4 309Forces 310.Nm 311to use IPv4 addresses only. 312.It Fl 6 313Forces 314.Nm 315to use IPv6 addresses only. 316.El 317.Sh CONFIGURATION FILE 318.Nm 319reads configuration data from 320.Pa /etc/ssh/sshd_config 321(or the file specified with 322.Fl f 323on the command line). 324The file format and configuration options are described in 325.Xr sshd_config 5 . 326.Sh LOGIN PROCESS 327When a user successfully logs in, 328.Nm 329does the following: 330.Bl -enum -offset indent 331.It 332If the login is on a tty, and no command has been specified, 333prints last login time and 334.Pa /etc/motd 335(unless prevented in the configuration file or by 336.Pa $HOME/.hushlogin ; 337see the 338.Sx FILES 339section). 340.It 341If the login is on a tty, records login time. 342.It 343Checks 344.Pa /etc/nologin and 345.Pa /var/run/nologin ; 346if one exists, it prints the contents and quits 347(unless root). 348.It 349Changes to run with normal user privileges. 350.It 351Sets up basic environment. 352.It 353Reads 354.Pa $HOME/.ssh/environment 355if it exists. 356.It 357Changes to user's home directory. 358.It 359If 360.Pa $HOME/.ssh/rc 361exists, runs it; else if 362.Pa /etc/ssh/sshrc 363exists, runs 364it; otherwise runs 365.Xr xauth 1 . 366The 367.Dq rc 368files are given the X11 369authentication protocol and cookie (if applicable) in standard input. 370.It 371Runs user's shell or command. 372.El 373.Sh AUTHORIZED_KEYS FILE FORMAT 374.Pa $HOME/.ssh/authorized_keys 375is the default file that lists the public keys that are 376permitted for RSA authentication in protocol version 1 377and for public key authentication (PubkeyAuthentication) 378in protocol version 2. 379.Cm AuthorizedKeysFile 380may be used to specify an alternative file. 381.Pp 382Each line of the file contains one 383key (empty lines and lines starting with a 384.Ql # 385are ignored as 386comments). 387Each RSA public key consists of the following fields, separated by 388spaces: options, bits, exponent, modulus, comment. 389Each protocol version 2 public key consists of: 390options, keytype, base64 encoded key, comment. 391The options fields 392are optional; its presence is determined by whether the line starts 393with a number or not (the option field never starts with a number). 394The bits, exponent, modulus and comment fields give the RSA key for 395protocol version 1; the 396comment field is not used for anything (but may be convenient for the 397user to identify the key). 398For protocol version 2 the keytype is 399.Dq ssh-dss 400or 401.Dq ssh-rsa . 402.Pp 403Note that lines in this file are usually several hundred bytes long 404(because of the size of the RSA key modulus). 405You don't want to type them in; instead, copy the 406.Pa identity.pub , 407.Pa id_dsa.pub 408or the 409.Pa id_rsa.pub 410file and edit it. 411.Pp 412.Nm 413enforces a minimum RSA key modulus size for protocol 1 414and protocol 2 keys of 768 bits. 415.Pp 416The options (if present) consist of comma-separated option 417specifications. 418No spaces are permitted, except within double quotes. 419The following option specifications are supported (note 420that option keywords are case-insensitive): 421.Bl -tag -width Ds 422.It Cm from="pattern-list" 423Specifies that in addition to RSA authentication, the canonical name 424of the remote host must be present in the comma-separated list of 425patterns 426.Pf ( Ql * 427and 428.Ql ? 429serve as wildcards). 430The list may also contain 431patterns negated by prefixing them with 432.Ql ! ; 433if the canonical host name matches a negated pattern, the key is not accepted. 434The purpose 435of this option is to optionally increase security: RSA authentication 436by itself does not trust the network or name servers or anything (but 437the key); however, if somebody somehow steals the key, the key 438permits an intruder to log in from anywhere in the world. 439This additional option makes using a stolen key more difficult (name 440servers and/or routers would have to be compromised in addition to 441just the key). 442.It Cm command="command" 443Specifies that the command is executed whenever this key is used for 444authentication. 445The command supplied by the user (if any) is ignored. 446The command is run on a pty if the client requests a pty; 447otherwise it is run without a tty. 448If a 8-bit clean channel is required, 449one must not request a pty or should specify 450.Cm no-pty . 451A quote may be included in the command by quoting it with a backslash. 452This option might be useful 453to restrict certain RSA keys to perform just a specific operation. 454An example might be a key that permits remote backups but nothing else. 455Note that the client may specify TCP/IP and/or X11 456forwarding unless they are explicitly prohibited. 457Note that this option applies to shell, command or subsystem execution. 458.It Cm environment="NAME=value" 459Specifies that the string is to be added to the environment when 460logging in using this key. 461Environment variables set this way 462override other default environment values. 463Multiple options of this type are permitted. 464This option is automatically disabled if 465.Cm UseLogin 466is enabled. 467.It Cm no-port-forwarding 468Forbids TCP/IP forwarding when this key is used for authentication. 469Any port forward requests by the client will return an error. 470This might be used, e.g., in connection with the 471.Cm command 472option. 473.It Cm no-X11-forwarding 474Forbids X11 forwarding when this key is used for authentication. 475Any X11 forward requests by the client will return an error. 476.It Cm no-agent-forwarding 477Forbids authentication agent forwarding when this key is used for 478authentication. 479.It Cm no-pty 480Prevents tty allocation (a request to allocate a pty will fail). 481.It Cm permitopen="host:port" 482Limit local 483.Li ``ssh -L'' 484port forwarding such that it may only connect to the specified host and 485port. 486IPv6 addresses can be specified with an alternative syntax: 487.Ar host/port . 488Multiple 489.Cm permitopen 490options may be applied separated by commas. No pattern matching is 491performed on the specified hostnames, they must be literal domains or 492addresses. 493.El 494.Ss Examples 4951024 33 12121.\|.\|.\|312314325 ylo@foo.bar 496.Pp 497from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23.\|.\|.\|2334 ylo@niksula 498.Pp 499command="dump /home",no-pty,no-port-forwarding 1024 33 23.\|.\|.\|2323 backup.hut.fi 500.Pp 501permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23.\|.\|.\|2323 502.Sh SSH_KNOWN_HOSTS FILE FORMAT 503The 504.Pa /etc/ssh/ssh_known_hosts 505and 506.Pa $HOME/.ssh/known_hosts 507files contain host public keys for all known hosts. 508The global file should 509be prepared by the administrator (optional), and the per-user file is 510maintained automatically: whenever the user connects from an unknown host 511its key is added to the per-user file. 512.Pp 513Each line in these files contains the following fields: hostnames, 514bits, exponent, modulus, comment. 515The fields are separated by spaces. 516.Pp 517Hostnames is a comma-separated list of patterns ('*' and '?' act as 518wildcards); each pattern in turn is matched against the canonical host 519name (when authenticating a client) or against the user-supplied 520name (when authenticating a server). 521A pattern may also be preceded by 522.Ql ! 523to indicate negation: if the host name matches a negated 524pattern, it is not accepted (by that line) even if it matched another 525pattern on the line. 526.Pp 527Bits, exponent, and modulus are taken directly from the RSA host key; they 528can be obtained, e.g., from 529.Pa /etc/ssh/ssh_host_key.pub . 530The optional comment field continues to the end of the line, and is not used. 531.Pp 532Lines starting with 533.Ql # 534and empty lines are ignored as comments. 535.Pp 536When performing host authentication, authentication is accepted if any 537matching line has the proper key. 538It is thus permissible (but not 539recommended) to have several lines or different host keys for the same 540names. 541This will inevitably happen when short forms of host names 542from different domains are put in the file. 543It is possible 544that the files contain conflicting information; authentication is 545accepted if valid information can be found from either file. 546.Pp 547Note that the lines in these files are typically hundreds of characters 548long, and you definitely don't want to type in the host keys by hand. 549Rather, generate them by a script 550or by taking 551.Pa /etc/ssh/ssh_host_key.pub 552and adding the host names at the front. 553.Ss Examples 554.Bd -literal 555closenet,.\|.\|.\|,130.233.208.41 1024 37 159.\|.\|.93 closenet.hut.fi 556cvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....= 557.Ed 558.Sh FILES 559.Bl -tag -width Ds 560.It Pa /etc/ssh/sshd_config 561Contains configuration data for 562.Nm sshd . 563The file format and configuration options are described in 564.Xr sshd_config 5 . 565.It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key 566These three files contain the private parts of the host keys. 567These files should only be owned by root, readable only by root, and not 568accessible to others. 569Note that 570.Nm 571does not start if this file is group/world-accessible. 572.It Pa /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub, /etc/ssh/ssh_host_rsa_key.pub 573These three files contain the public parts of the host keys. 574These files should be world-readable but writable only by 575root. 576Their contents should match the respective private parts. 577These files are not 578really used for anything; they are provided for the convenience of 579the user so their contents can be copied to known hosts files. 580These files are created using 581.Xr ssh-keygen 1 . 582.It Pa /etc/ssh/moduli 583Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange". 584.It Pa /var/run/sshd.pid 585Contains the process ID of the 586.Nm 587listening for connections (if there are several daemons running 588concurrently for different ports, this contains the pid of the one 589started last). 590The content of this file is not sensitive; it can be world-readable. 591.It Pa $HOME/.ssh/authorized_keys 592Lists the public keys (RSA or DSA) that can be used to log into the user's account. 593This file must be readable by root (which may on some machines imply 594it being world-readable if the user's home directory resides on an NFS 595volume). 596It is recommended that it not be accessible by others. 597The format of this file is described above. 598Users will place the contents of their 599.Pa identity.pub , 600.Pa id_dsa.pub 601and/or 602.Pa id_rsa.pub 603files into this file, as described in 604.Xr ssh-keygen 1 . 605.It Pa "/etc/ssh/ssh_known_hosts" and "$HOME/.ssh/known_hosts" 606These files are consulted when using rhosts with RSA host 607authentication or protocol version 2 hostbased authentication 608to check the public key of the host. 609The key must be listed in one of these files to be accepted. 610The client uses the same files 611to verify that it is connecting to the correct remote host. 612These files should be writable only by root/the owner. 613.Pa /etc/ssh/ssh_known_hosts 614should be world-readable, and 615.Pa $HOME/.ssh/known_hosts 616can but need not be world-readable. 617.It Pa /etc/nologin 618If this file exists, 619.Nm 620refuses to let anyone except root log in. 621The contents of the file 622are displayed to anyone trying to log in, and non-root connections are 623refused. 624The file should be world-readable. 625.It Pa /etc/hosts.allow, /etc/hosts.deny 626Access controls that should be enforced by tcp-wrappers are defined here. 627Further details are described in 628.Xr hosts_access 5 . 629.It Pa $HOME/.rhosts 630This file contains host-username pairs, separated by a space, one per 631line. 632The given user on the corresponding host is permitted to log in 633without password. 634The same file is used by rlogind and rshd. 635The file must 636be writable only by the user; it is recommended that it not be 637accessible by others. 638.Pp 639If is also possible to use netgroups in the file. 640Either host or user 641name may be of the form +@groupname to specify all hosts or all users 642in the group. 643.It Pa $HOME/.shosts 644For ssh, 645this file is exactly the same as for 646.Pa .rhosts . 647However, this file is 648not used by rlogin and rshd, so using this permits access using SSH only. 649.It Pa /etc/hosts.equiv 650This file is used during 651.Pa .rhosts 652authentication. 653In the simplest form, this file contains host names, one per line. 654Users on 655those hosts are permitted to log in without a password, provided they 656have the same user name on both machines. 657The host name may also be 658followed by a user name; such users are permitted to log in as 659.Em any 660user on this machine (except root). 661Additionally, the syntax 662.Dq +@group 663can be used to specify netgroups. 664Negated entries start with 665.Ql \&- . 666.Pp 667If the client host/user is successfully matched in this file, login is 668automatically permitted provided the client and server user names are the 669same. 670Additionally, successful RSA host authentication is normally required. 671This file must be writable only by root; it is recommended 672that it be world-readable. 673.Pp 674.Sy "Warning: It is almost never a good idea to use user names in" 675.Pa hosts.equiv . 676Beware that it really means that the named user(s) can log in as 677.Em anybody , 678which includes bin, daemon, adm, and other accounts that own critical 679binaries and directories. 680Using a user name practically grants the user root access. 681The only valid use for user names that I can think 682of is in negative entries. 683.Pp 684Note that this warning also applies to rsh/rlogin. 685.It Pa /etc/ssh/shosts.equiv 686This is processed exactly as 687.Pa /etc/hosts.equiv . 688However, this file may be useful in environments that want to run both 689rsh/rlogin and ssh. 690.It Pa $HOME/.ssh/environment 691This file is read into the environment at login (if it exists). 692It can only contain empty lines, comment lines (that start with 693.Ql # ) , 694and assignment lines of the form name=value. 695The file should be writable 696only by the user; it need not be readable by anyone else. 697.It Pa $HOME/.ssh/rc 698If this file exists, it is run with 699.Pa /bin/sh 700after reading the 701environment files but before starting the user's shell or command. 702It must not produce any output on stdout; stderr must be used 703instead. 704If X11 forwarding is in use, it will receive the "proto cookie" pair in 705its standard input (and 706.Ev DISPLAY 707in its environment). 708The script must call 709.Xr xauth 1 710because 711.Nm 712will not run xauth automatically to add X11 cookies. 713.Pp 714The primary purpose of this file is to run any initialization routines 715which may be needed before the user's home directory becomes 716accessible; AFS is a particular example of such an environment. 717.Pp 718This file will probably contain some initialization code followed by 719something similar to: 720.Bd -literal 721if read proto cookie && [ -n "$DISPLAY" ]; then 722 if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then 723 # X11UseLocalhost=yes 724 xauth add unix:`echo $DISPLAY | 725 cut -c11-` $proto $cookie 726 else 727 # X11UseLocalhost=no 728 xauth add $DISPLAY $proto $cookie 729 fi 730fi 731.Ed 732.Pp 733If this file does not exist, 734.Pa /etc/ssh/sshrc 735is run, and if that 736does not exist either, xauth is used to add the cookie. 737.Pp 738This file should be writable only by the user, and need not be 739readable by anyone else. 740.It Pa /etc/ssh/sshrc 741Like 742.Pa $HOME/.ssh/rc . 743This can be used to specify 744machine-specific login-time initializations globally. 745This file should be writable only by root, and should be world-readable. 746.El 747.Sh AUTHORS 748OpenSSH is a derivative of the original and free 749ssh 1.2.12 release by Tatu Ylonen. 750Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 751Theo de Raadt and Dug Song 752removed many bugs, re-added newer features and 753created OpenSSH. 754Markus Friedl contributed the support for SSH 755protocol versions 1.5 and 2.0. 756Niels Provos and Markus Friedl contributed support 757for privilege separation. 758.Sh SEE ALSO 759.Xr scp 1 , 760.Xr sftp 1 , 761.Xr ssh 1 , 762.Xr ssh-add 1 , 763.Xr ssh-agent 1 , 764.Xr ssh-keygen 1 , 765.Xr login.conf 5 , 766.Xr moduli 5 , 767.Xr sshd_config 5 , 768.Xr sftp-server 8 769.Rs 770.%A T. Ylonen 771.%A T. Kivinen 772.%A M. Saarinen 773.%A T. Rinne 774.%A S. Lehtinen 775.%T "SSH Protocol Architecture" 776.%N draft-ietf-secsh-architecture-12.txt 777.%D January 2002 778.%O work in progress material 779.Re 780.Rs 781.%A M. Friedl 782.%A N. Provos 783.%A W. A. Simpson 784.%T "Diffie-Hellman Group Exchange for the SSH Transport Layer Protocol" 785.%N draft-ietf-secsh-dh-group-exchange-02.txt 786.%D January 2002 787.%O work in progress material 788.Re 789