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.\" $MirOS: src/usr.bin/ssh/sshd.8,v 1.20 2011/01/15 21:52:44 tg Exp $ 38.\" $OpenBSD: sshd.8,v 1.248 2009/03/26 08:38:39 sobrado Exp $ 39.Dd $Mdocdate: January 15 2011 $ 40.Dt SSHD 8 41.Os 42.Sh NAME 43.Nm sshd 44.Nd OpenSSH SSH daemon 45.Sh SYNOPSIS 46.Nm sshd 47.Bk -words 48.Op Fl 46DdeiqTt 49.Op Fl b Ar bits 50.Op Fl C Ar connection_spec 51.Op Fl f Ar config_file 52.Op Fl g Ar login_grace_time 53.Op Fl h Ar host_key_file 54.Op Fl k Ar key_gen_time 55.Op Fl o Ar option 56.Op Fl p Ar port 57.Op Fl u Ar len 58.Ek 59.Sh DESCRIPTION 60.Nm 61(OpenSSH Daemon) is the daemon program for 62.Xr ssh 1 . 63Together these programs replace 64.Xr rlogin 1 65and 66.Xr rsh 1 , 67and provide secure encrypted communications between two untrusted hosts 68over an insecure network. 69.Pp 70.Nm 71listens for connections from clients. 72It is normally started at boot from 73.Pa /etc/rc . 74It forks a new 75daemon for each incoming connection. 76The forked daemons handle 77key exchange, encryption, authentication, command execution, 78and data exchange. 79.Pp 80.Nm 81can be configured using command-line options or a configuration file 82(by default 83.Xr sshd_config 5 ) ; 84command-line options override values specified in the 85configuration file. 86.Nm 87rereads its configuration file when it receives a hangup signal, 88.Dv SIGHUP , 89by executing itself with the name and options it was started with, e.g.\& 90.Pa /usr/sbin/sshd . 91.Pp 92The options are as follows: 93.Bl -tag -width Ds 94.It Fl 4 95Forces 96.Nm 97to use IPv4 addresses only. 98.It Fl 6 99Forces 100.Nm 101to use IPv6 addresses only. 102.It Fl b Ar bits 103Specifies the number of bits in the ephemeral protocol version 1 104server key (default 1024). 105.It Fl C Ar connection_spec 106Specify the connection parameters to use for the 107.Fl T 108extended test mode. 109If provided, any 110.Cm Match 111directives in the configuration file 112that would apply to the specified user, host, and address will be set before 113the configuration is written to standard output. 114The connection parameters are supplied as keyword=value pairs. 115The keywords are 116.Dq user , 117.Dq host , 118and 119.Dq addr . 120All are required and may be supplied in any order, either with multiple 121.Fl C 122options or as a comma-separated list. 123.It Fl D 124When this option is specified, 125.Nm 126will not detach and does not become a daemon. 127This allows easy monitoring of 128.Nm sshd . 129.It Fl d 130Debug mode. 131The server sends verbose debug output to the system 132log, and does not put itself in the background. 133The server also will not fork and will only process one connection. 134This option is only intended for debugging for the server. 135Multiple 136.Fl d 137options increase the debugging level. 138Maximum is 3. 139.It Fl e 140When this option is specified, 141.Nm 142will send the output to the standard error instead of the system log. 143.It Fl f Ar config_file 144Specifies the name of the configuration file. 145The default is 146.Pa /etc/ssh/sshd_config . 147.Nm 148refuses to start if there is no configuration file. 149.It Fl g Ar login_grace_time 150Gives the grace time for clients to authenticate themselves (default 151120 seconds). 152If the client fails to authenticate the user within 153this many seconds, the server disconnects and exits. 154A value of zero indicates no limit. 155.It Fl h Ar host_key_file 156Specifies a file from which a host key is read. 157This option must be given if 158.Nm 159is not run as root (as the normal 160host key files are normally not readable by anyone but root). 161The default is 162.Pa /etc/ssh/ssh_host_key 163for protocol version 1, and 164.Pa /etc/ssh/ssh_host_rsa_key 165and 166.Pa /etc/ssh/ssh_host_dsa_key 167for protocol version 2. 168It is possible to have multiple host key files for 169the different protocol versions and host key algorithms. 170.br 171.It Fl i 172Specifies that 173.Nm 174is being run from 175.Xr inetd 8 . 176.Nm 177is normally not run 178from inetd because it needs to generate the server key before it can 179respond to the client, and this may take tens of seconds. 180Clients would have to wait too long if the key was regenerated every time. 181However, with small key sizes (e.g. 512) using 182.Nm 183from inetd may 184be feasible. 185.It Fl k Ar key_gen_time 186Specifies how often the ephemeral protocol version 1 server key is 187regenerated (default 3600 seconds, or one hour). 188The motivation for regenerating the key fairly 189often is that the key is not stored anywhere, and after about an hour 190it becomes impossible to recover the key for decrypting intercepted 191communications even if the machine is cracked into or physically 192seized. 193A value of zero indicates that the key will never be regenerated. 194.It Fl o Ar option 195Can be used to give options in the format used in the configuration file. 196This is useful for specifying options for which there is no separate 197command-line flag. 198For full details of the options, and their values, see 199.Xr sshd_config 5 . 200.It Fl p Ar port 201Specifies the port on which the server listens for connections 202(default 22). 203Multiple port options are permitted. 204Ports specified in the configuration file with the 205.Cm Port 206option are ignored when a command-line port is specified. 207Ports specified using the 208.Cm ListenAddress 209option override command-line ports. 210.It Fl q 211Quiet mode. 212Nothing is sent to the system log. 213Normally the beginning, 214authentication, and termination of each connection is logged. 215.It Fl T 216Extended test mode. 217Check the validity of the configuration file, output the effective configuration 218to stdout and then exit. 219Optionally, 220.Cm Match 221rules may be applied by specifying the connection parameters using one or more 222.Fl C 223options. 224.It Fl t 225Test mode. 226Only check the validity of the configuration file and sanity of the keys. 227This is useful for updating 228.Nm 229reliably as configuration options may change. 230.It Fl u Ar len 231This option is used to specify the size of the field 232in the 233.Li utmp 234structure that holds the remote host name. 235If the resolved host name is longer than 236.Ar len , 237the dotted decimal value will be used instead. 238This allows hosts with very long host names that 239overflow this field to still be uniquely identified. 240Specifying 241.Fl u0 242indicates that only dotted decimal addresses 243should be put into the 244.Pa utmp 245file. 246.Fl u0 247may also be used to prevent 248.Nm 249from making DNS requests unless the authentication 250mechanism or configuration requires it. 251Authentication mechanisms that may require DNS include 252.Cm RhostsRSAAuthentication , 253.Cm HostbasedAuthentication , 254and using a 255.Cm from="pattern-list" 256option in a key file. 257Configuration options that require DNS include using a 258USER@HOST pattern in 259.Cm AllowUsers 260or 261.Cm DenyUsers . 262.El 263.Sh AUTHENTICATION 264The OpenSSH SSH daemon supports SSH protocols 1 and 2. 265Both protocols are supported by default, 266though this can be changed via the 267.Cm Protocol 268option in 269.Xr sshd_config 5 . 270Protocol 2 supports both RSA and DSA keys; 271protocol 1 only supports RSA keys. 272For both protocols, 273each host has a host-specific key, 274normally 2048 bits, 275used to identify the host. 276Much longer RSA keys should be used, but this makes 277logins very slow if less powerful machines are involved. 278DSA keys cannot be longer than 2048 bits due to misdesign, though. 279On 280.Mx , 281only protocol 2 RSA is enabled by default to improve security. 282.Pp 283Forward security for protocol 1 is provided through 284an additional server key, 285normally 768 bits, 286generated when the server starts. 287This key is normally regenerated every hour if it has been used, and 288is never stored on disk. 289Whenever a client connects, the daemon responds with its public 290host and server keys. 291The client compares the 292RSA host key against its own database to verify that it has not changed. 293The client then generates a 256-bit random number. 294It encrypts this 295random number using both the host key and the server key, and sends 296the encrypted number to the server. 297Both sides then use this 298random number as a session key which is used to encrypt all further 299communications in the session. 300The rest of the session is encrypted 301using a conventional cipher, currently Blowfish or 3DES, with Blowfish 302being used by default. 303The client selects the encryption algorithm 304to use from those offered by the server. 305.Pp 306For protocol 2, 307forward security is provided through a Diffie-Hellman key agreement. 308This key agreement results in a shared session key. 309The rest of the session is encrypted using a symmetric cipher, currently 310128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES. 311The client selects the encryption algorithm 312to use from those offered by the server. 313Additionally, session integrity is provided 314through a cryptographic message authentication code 315(umac-64, hmac-ripemd160, hmac-sha1 or hmac-md5). 316.Pp 317Finally, the server and the client enter an authentication dialog. 318The client tries to authenticate itself using 319host-based authentication, 320public key authentication, 321challenge-response authentication, 322or password authentication. 323.Pp 324If the client successfully authenticates itself, a dialog for 325preparing the session is entered. 326At this time the client may request 327things like allocating a pseudo-tty, forwarding X11 connections, 328forwarding TCP connections, or forwarding the authentication agent 329connection over the secure channel. 330.Pp 331After this, the client either requests a shell or execution of a command. 332The sides then enter session mode. 333In this mode, either side may send 334data at any time, and such data is forwarded to/from the shell or 335command on the server side, and the user terminal in the client side. 336.Pp 337When the user program terminates and all forwarded X11 and other 338connections have been closed, the server sends command exit status to 339the client, and both sides exit. 340.Sh LOGIN PROCESS 341When a user successfully logs in, 342.Nm 343does the following: 344.Bl -enum -offset indent 345.It 346If the login is on a tty, and no command has been specified, 347prints last login time and 348.Pa /etc/motd 349(unless prevented in the configuration file or by 350.Pa ~/.hushlogin ; 351see the 352.Sx FILES 353section). 354.It 355If the login is on a tty, records login time. 356.It 357Checks 358.Pa /etc/nologin ; 359if it exists, prints contents and quits 360(unless root). 361.It 362Changes to run with normal user privileges. 363.It 364Sets up basic environment. 365.It 366Reads the file 367.Pa ~/.etc/ssh/environment , 368if it exists, and users are allowed to change their environment. 369See the 370.Cm PermitUserEnvironment 371option in 372.Xr sshd_config 5 . 373.It 374Changes to user's home directory. 375.It 376If 377.Pa ~/.etc/ssh/rc 378exists, runs it; else if 379.Pa /etc/ssh/sshrc 380exists, runs 381it; otherwise runs xauth. 382The 383.Dq rc 384files are given the X11 385authentication protocol and cookie in standard input. 386See 387.Sx SSHRC , 388below. 389.It 390Runs user's shell or command. 391.El 392.Sh SSHRC 393If the file 394.Pa ~/.etc/ssh/rc 395exists, 396.Xr sh 1 397runs it after reading the 398environment files but before starting the user's shell or command. 399It must not produce any output on stdout; stderr must be used 400instead. 401If X11 forwarding is in use, it will receive the "proto cookie" pair in 402its standard input (and 403.Ev DISPLAY 404in its environment). 405The script must call 406.Xr xauth 1 407because 408.Nm 409will not run xauth automatically to add X11 cookies. 410.Pp 411The primary purpose of this file is to run any initialization routines 412which may be needed before the user's home directory becomes 413accessible; AFS is a particular example of such an environment. 414.Pp 415This file will probably contain some initialization code followed by 416something similar to: 417.Bd -literal -offset 3n 418if read proto cookie && [ -n "$DISPLAY" ]; then 419 if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then 420 # X11UseLocalhost=yes 421 echo add unix:`echo $DISPLAY | 422 cut -c11-` $proto $cookie 423 else 424 # X11UseLocalhost=no 425 echo add $DISPLAY $proto $cookie 426 fi | xauth -q - 427fi 428.Ed 429.Pp 430If this file does not exist, 431.Pa /etc/ssh/sshrc 432is run, and if that 433does not exist either, xauth is used to add the cookie. 434.Sh AUTHORISED_KEYS FILE FORMAT 435.Cm AuthorisedKeysFile 436specifies the file containing public keys for 437public key authentication; 438if none is specified, the default is 439.Pa ~/.etc/ssh/authorised_keys . 440If the user is the superuser and his home directory the root or unset, 441/etc/ssh/root:authorised_keys 442is used instead. 443Each line of the file contains one 444key (empty lines and lines starting with a 445.Ql # 446are ignored as 447comments). 448Protocol 1 public keys consist of the following space-separated fields: 449options, bits, exponent, modulus, comment. 450Protocol 2 public key consist of: 451options, keytype, base64-encoded key, comment. 452The options field is optional; 453its presence is determined by whether the line starts 454with a number or not (the options field never starts with a number). 455The bits, exponent, modulus, and comment fields give the RSA key for 456protocol version 1; the 457comment field is not used for anything (but may be convenient for the 458user to identify the key). 459For protocol version 2 the keytype is 460.Dq ssh-dss 461or 462.Dq ssh-rsa . 463.Pp 464Note that lines in this file are usually several hundred bytes long 465(because of the size of the public key encoding) up to a limit of 4668 kilobytes, which permits DSA keys up to 8 kilobits and RSA 467keys up to 16 kilobits. 468You don't want to type them in; instead, copy the 469.Pa identity.pub , 470.Pa id_dsa.pub , 471or the 472.Pa id_rsa.pub 473file and edit it. 474.Pp 475.Nm 476enforces a minimum RSA key modulus size for protocol 1 477and protocol 2 keys of 768 bits. 478.Pp 479The options (if present) consist of comma-separated option 480specifications. 481No spaces are permitted, except within double quotes. 482The following option specifications are supported (note 483that option keywords are case-insensitive): 484.Bl -tag -width Ds 485.It Cm command="command" 486Specifies that the command is executed whenever this key is used for 487authentication. 488The command supplied by the user (if any) is ignored. 489The command is run on a pty if the client requests a pty; 490otherwise it is run without a tty. 491If an 8-bit clean channel is required, 492one must not request a pty or should specify 493.Cm no-pty . 494A quote may be included in the command by quoting it with a backslash. 495This option might be useful 496to restrict certain public keys to perform just a specific operation. 497An example might be a key that permits remote backups but nothing else. 498Note that the client may specify TCP and/or X11 499forwarding unless they are explicitly prohibited. 500The command originally supplied by the client is available in the 501.Ev SSH_ORIGINAL_COMMAND 502environment variable. 503Note that this option applies to shell, command or subsystem execution. 504.It Cm environment="NAME=value" 505Specifies that the string is to be added to the environment when 506logging in using this key. 507Environment variables set this way 508override other default environment values. 509Multiple options of this type are permitted. 510Environment processing is disabled by default and is 511controlled via the 512.Cm PermitUserEnvironment 513option. 514This option is automatically disabled if 515.Cm UseLogin 516is enabled. 517.It Cm from="pattern-list" 518Specifies that in addition to public key authentication, either the canonical 519name of the remote host or its IP address must be present in the 520comma-separated list of patterns. 521See 522.Sx PATTERNS 523in 524.Xr ssh_config 5 525for more information on patterns. 526.Pp 527In addition to the wildcard matching that may be applied to hostnames or 528addresses, a 529.Cm from 530stanza may match IP addresses using CIDR address/masklen notation. 531.Pp 532The purpose of this option is to optionally increase security: public key 533authentication by itself does not trust the network or name servers or 534anything (but the key); however, if somebody somehow steals the key, the key 535permits an intruder to log in from anywhere in the world. 536This additional option makes using a stolen key more difficult (name 537servers and/or routers would have to be compromised in addition to 538just the key). 539.It Cm no-agent-forwarding 540Forbids authentication agent forwarding when this key is used for 541authentication. 542.It Cm no-port-forwarding 543Forbids TCP forwarding when this key is used for authentication. 544Any port forward requests by the client will return an error. 545This might be used, e.g. in connection with the 546.Cm command 547option. 548.It Cm no-pty 549Prevents tty allocation (a request to allocate a pty will fail). 550.It Cm no-user-rc 551Disables execution of 552.Pa ~/.etc/ssh/rc . 553.It Cm no-X11-forwarding 554Forbids X11 forwarding when this key is used for authentication. 555Any X11 forward requests by the client will return an error. 556.It Cm permitopen="host:port" 557Limit local 558.Li "ssh -L" 559port forwarding such that it may only connect to the specified host and 560port. 561IPv6 addresses can be specified with an alternative syntax: 562.Ar host Ns / Ns Ar port . 563Multiple 564.Cm permitopen 565options may be applied separated by commas. 566No pattern matching is performed on the specified hostnames, 567they must be literal domains or addresses. 568.It Cm tunnel="n" 569Force a 570.Xr tun 4 571device on the server. 572Without this option, the next available device will be used if 573the client requests a tunnel. 574.El 575.Pp 576An example authorised_keys file: 577.Bd -literal -offset 3n 578# Comments allowed at start of line 579ssh-rsa AAAAB3Nza...LiPk== user@example.net 580from="*.sales.example.net,!pc.sales.example.net" ssh-rsa 581AAAAB2...19Q== john@example.net 582command="dump /home",no-pty,no-port-forwarding ssh-dss 583AAAAC3...51R== example.net 584permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss 585AAAAB5...21S== 586tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== 587jane@example.net 588.Ed 589.Sh SSH_KNOWN_HOSTS FILE FORMAT 590The 591.Pa /etc/ssh/ssh_known_hosts 592and 593.Pa ~/.etc/ssh/known_hosts 594and 595.Pa /etc/ssh/root:known_hosts , 596if the user is the superuser and his home directory the root or unset, 597files contain host public keys for all known hosts. 598The global file should 599be prepared by the administrator (optional), and the per-user file is 600maintained automatically: whenever the user connects from an unknown host, 601its key is added to the per-user file. 602.Pp 603Each line in these files contains the following fields: hostnames, 604bits, exponent, modulus, comment. 605The fields are separated by spaces. 606.Pp 607Hostnames is a comma-separated list of patterns 608.Pf ( Ql * 609and 610.Ql \&? 611act as 612wildcards); each pattern in turn is matched against the canonical host 613name (when authenticating a client) or against the user-supplied 614name (when authenticating a server). 615A pattern may also be preceded by 616.Ql \&! 617to indicate negation: if the host name matches a negated 618pattern, it is not accepted (by that line) even if it matched another 619pattern on the line. 620A hostname or address may optionally be enclosed within 621.Ql \&[ 622and 623.Ql \&] 624brackets then followed by 625.Ql \&: 626and a non-standard port number. 627.Pp 628Alternately, hostnames may be stored in a hashed form which hides host names 629and addresses should the file's contents be disclosed. 630Hashed hostnames start with a 631.Ql | 632character. 633Only one hashed hostname may appear on a single line and none of the above 634negation or wildcard operators may be applied. 635.Pp 636Bits, exponent, and modulus are taken directly from the RSA host key; they 637can be obtained, for example, from 638.Pa /etc/ssh/ssh_host_key.pub . 639The optional comment field continues to the end of the line, and is not used. 640.Pp 641Lines starting with 642.Ql # 643and empty lines are ignored as comments. 644.Pp 645When performing host authentication, authentication is accepted if any 646matching line has the proper key. 647It is thus permissible (but not 648recommended) to have several lines or different host keys for the same 649names. 650This will inevitably happen when short forms of host names 651from different domains are put in the file. 652It is possible 653that the files contain conflicting information; authentication is 654accepted if valid information can be found from either file. 655.Pp 656Note that the lines in these files are typically hundreds of characters 657long, and you definitely don't want to type in the host keys by hand. 658Rather, generate them by a script 659or by taking 660.Pa /etc/ssh/ssh_host_key.pub 661and adding the host names at the front. 662.Pp 663An example ssh_known_hosts file: 664.Bd -literal -offset 3n 665# Comments allowed at start of line 666closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net 667cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....= 668# A hashed hostname 669|1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa 670AAAA1234.....= 671.Ed 672.Sh FILES 673.Bl -tag -width Ds -compact 674.It ~/.hushlogin 675This file is used to suppress printing the last login time and 676.Pa /etc/motd , 677if 678.Cm PrintLastLog 679and 680.Cm PrintMotd , 681respectively, 682are enabled. 683It does not suppress printing of the banner specified by 684.Cm Banner . 685.Pp 686.It ~/.rhosts 687This file is used for host-based authentication (see 688.Xr ssh 1 689for more information). 690On some machines this file may need to be 691world-readable if the user's home directory is on an NFS partition, 692because 693.Nm 694reads it as root. 695Additionally, this file must be owned by the user, 696and must not have write permissions for anyone else. 697The recommended 698permission for most machines is read/write for the user, and not 699accessible by others. 700.Pp 701.It ~/.shosts 702This file is used in exactly the same way as 703.Pa .rhosts , 704but allows host-based authentication without permitting login with 705rlogin/rsh. 706.Pp 707.It ~/.etc/ssh/ 708This directory is the default location for all user-specific configuration 709and authentication information. 710There is no general requirement to keep the entire contents of this directory 711secret, but the recommended permissions are read/write/execute for the user, 712and not accessible by others. 713.Pp 714.It ~/.etc/ssh/authorised_keys 715Lists the public keys (RSA/DSA) that can be used for logging in as this user. 716The format of this file is described above. 717The content of the file is not highly sensitive, but the recommended 718permissions are read/write for the user, and not accessible by others. 719If this file, the 720.Pa ~/.etc/ssh 721directory, or the user's home directory are writable 722by other users, then the file could be modified or replaced by unauthorised 723users. 724In this case, 725.Nm 726will not allow it to be used unless the 727.Cm StrictModes 728option has been set to 729.Dq no . 730.Pp 731.It /etc/ssh/root:authorised_keys 732The same, for the superuser, if his home is the root directory or unset. 733.Pp 734.It ~/.ssh/authorized_keys 735Portable name for the above file. 736.Pp 737.It ~/.etc/ssh/environment 738This file is read into the environment at login (if it exists). 739It can only contain empty lines, comment lines (that start with 740.Ql # ) , 741and assignment lines of the form name=value. 742The file should be writable 743only by the user; it need not be readable by anyone else. 744Environment processing is disabled by default and is 745controlled via the 746.Cm PermitUserEnvironment 747option. 748.Pp 749.It ~/.etc/ssh/known_hosts 750Contains a list of host keys for all hosts the user has logged into 751that are not already in the systemwide list of known host keys. 752The format of this file is described above. 753This file should be writable only by root/the owner and 754can, but need not be, world-readable. 755.Pp 756.It /etc/ssh/root:known_hosts 757The same, for the superuser, if his home is the root directory or unset. 758.Pp 759.It ~/.etc/ssh/rc 760Contains initialization routines to be run before 761the user's home directory becomes accessible. 762This file should be writable only by the user, and need not be 763readable by anyone else. 764.Pp 765.It /etc/hosts.allow 766.It /etc/hosts.deny 767Access controls that should be enforced by tcp-wrappers are defined here. 768Further details are described in 769.Xr hosts_access 5 . 770.Pp 771.It /etc/hosts.equiv 772This file is for host-based authentication (see 773.Xr ssh 1 ) . 774It should only be writable by root. 775.Pp 776.It /etc/moduli 777Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange". 778The file format is described in 779.Xr moduli 5 . 780.Pp 781.It /etc/motd 782See 783.Xr motd 5 . 784.Pp 785.It /etc/nologin 786If this file exists, 787.Nm 788refuses to let anyone except root log in. 789The contents of the file 790are displayed to anyone trying to log in, and non-root connections are 791refused. 792The file should be world-readable. 793.Pp 794.It /etc/shosts.equiv 795This file is used in exactly the same way as 796.Pa hosts.equiv , 797but allows host-based authentication without permitting login with 798rlogin/rsh. 799.Pp 800.It /etc/ssh/ssh_host_key 801.It /etc/ssh/ssh_host_dsa_key 802.It /etc/ssh/ssh_host_rsa_key 803These three files contain the private parts of the host keys. 804These files should only be owned by root, readable only by root, and not 805accessible to others. 806Note that 807.Nm 808does not start if these files are group/world-accessible. 809.Pp 810.It /etc/ssh/ssh_host_key.pub 811.It /etc/ssh/ssh_host_dsa_key.pub 812.It /etc/ssh/ssh_host_rsa_key.pub 813These three files contain the public parts of the host keys. 814These files should be world-readable but writable only by 815root. 816Their contents should match the respective private parts. 817These files are not 818really used for anything; they are provided for the convenience of 819the user so their contents can be copied to known hosts files. 820These files are created using 821.Xr ssh-keygen 1 . 822.Pp 823.It /etc/ssh/ssh_known_hosts 824Systemwide list of known host keys. 825This file should be prepared by the 826system administrator to contain the public host keys of all machines in the 827organization. 828The format of this file is described above. 829This file should be writable only by root/the owner and 830should be world-readable. 831.Pp 832.It /etc/ssh/sshd_config 833Contains configuration data for 834.Nm sshd . 835The file format and configuration options are described in 836.Xr sshd_config 5 . 837.Pp 838.It /etc/ssh/sshrc 839Similar to 840.Pa ~/.etc/ssh/rc , 841it can be used to specify 842machine-specific login-time initializations globally. 843This file should be writable only by root, and should be world-readable. 844.Pp 845.It /var/empty 846.Xr chroot 2 847directory used by 848.Nm 849during privilege separation in the pre-authentication phase. 850The directory should not contain any files and must be owned by root 851and not group or world-writable. 852.Pp 853.It /var/run/sshd.pid 854Contains the process ID of the 855.Nm 856listening for connections (if there are several daemons running 857concurrently for different ports, this contains the process ID of the one 858started last). 859The content of this file is not sensitive; it can be world-readable. 860.El 861.Sh SEE ALSO 862.Xr scp 1 , 863.Xr sftp 1 , 864.Xr ssh 1 , 865.Xr ssh-add 1 , 866.Xr ssh-agent 1 , 867.Xr ssh-keygen 1 , 868.Xr ssh-keyscan 1 , 869.Xr chroot 2 , 870.Xr hosts_access 5 , 871.Xr login.conf 5 , 872.Xr moduli 5 , 873.Xr sshd_config 5 , 874.Xr inetd 8 , 875.Xr sftp-server 8 876.Sh AUTHORS 877OpenSSH is a derivative of the original and free 878ssh 1.2.12 release by Tatu Ylonen. 879Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 880Theo de Raadt and Dug Song 881removed many bugs, re-added newer features and 882created OpenSSH. 883Markus Friedl contributed the support for SSH 884protocol versions 1.5 and 2.0. 885Niels Provos and Markus Friedl contributed support 886for privilege separation. 887.Sh CAVEATS 888System security is not improved unless 889.Nm rshd , 890.Nm rlogind , 891and 892.Nm rexecd 893are disabled (thus completely disabling 894.Xr rlogin 895and 896.Xr rsh 897into the machine). 898