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_config.5,v 1.13 2002/09/16 20:12:11 stevesk Exp $ 38.\" $FreeBSD$ 39.Dd September 25, 1999 40.Dt SSHD_CONFIG 5 41.Os 42.Sh NAME 43.Nm sshd_config 44.Nd OpenSSH SSH daemon configuration file 45.Sh SYNOPSIS 46.Bl -tag -width Ds -compact 47.It Pa /etc/ssh/sshd_config 48.El 49.Sh DESCRIPTION 50.Nm sshd 51reads configuration data from 52.Pa /etc/ssh/sshd_config 53(or the file specified with 54.Fl f 55on the command line). 56The file contains keyword-argument pairs, one per line. 57Lines starting with 58.Ql # 59and empty lines are interpreted as comments. 60.Pp 61The possible 62keywords and their meanings are as follows (note that 63keywords are case-insensitive and arguments are case-sensitive): 64.Bl -tag -width Ds 65.It Cm AFSTokenPassing 66Specifies whether an AFS token may be forwarded to the server. 67Default is 68.Dq no . 69.It Cm AllowGroups 70This keyword can be followed by a list of group name patterns, separated 71by spaces. 72If specified, login is allowed only for users whose primary 73group or supplementary group list matches one of the patterns. 74.Ql \&* 75and 76.Ql ? 77can be used as 78wildcards in the patterns. 79Only group names are valid; a numerical group ID is not recognized. 80By default, login is allowed for all groups. 81.Pp 82.It Cm AllowTcpForwarding 83Specifies whether TCP forwarding is permitted. 84The default is 85.Dq yes . 86Note that disabling TCP forwarding does not improve security unless 87users are also denied shell access, as they can always install their 88own forwarders. 89.Pp 90.It Cm AllowUsers 91This keyword can be followed by a list of user name patterns, separated 92by spaces. 93If specified, login is allowed only for users names that 94match one of the patterns. 95.Ql \&* 96and 97.Ql ? 98can be used as 99wildcards in the patterns. 100Only user names are valid; a numerical user ID is not recognized. 101By default, login is allowed for all users. 102If the pattern takes the form USER@HOST then USER and HOST 103are separately checked, restricting logins to particular 104users from particular hosts. 105.Pp 106.It Cm AuthorizedKeysFile 107Specifies the file that contains the public keys that can be used 108for user authentication. 109.Cm AuthorizedKeysFile 110may contain tokens of the form %T which are substituted during connection 111set-up. The following tokens are defined: %% is replaced by a literal '%', 112%h is replaced by the home directory of the user being authenticated and 113%u is replaced by the username of that user. 114After expansion, 115.Cm AuthorizedKeysFile 116is taken to be an absolute path or one relative to the user's home 117directory. 118The default is 119.Dq .ssh/authorized_keys . 120.It Cm Banner 121In some jurisdictions, sending a warning message before authentication 122may be relevant for getting legal protection. 123The contents of the specified file are sent to the remote user before 124authentication is allowed. 125This option is only available for protocol version 2. 126By default, no banner is displayed. 127.Pp 128.It Cm ChallengeResponseAuthentication 129Specifies whether challenge response authentication is allowed. 130All authentication styles from 131.Xr login.conf 5 132are supported. 133The default is 134.Dq yes . 135.It Cm Ciphers 136Specifies the ciphers allowed for protocol version 2. 137Multiple ciphers must be comma-separated. 138The default is 139.Pp 140.Bd -literal 141 ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour, 142 aes192-cbc,aes256-cbc'' 143.Ed 144.It Cm ClientAliveInterval 145Sets a timeout interval in seconds after which if no data has been received 146from the client, 147.Nm sshd 148will send a message through the encrypted 149channel to request a response from the client. 150The default 151is 0, indicating that these messages will not be sent to the client. 152This option applies to protocol version 2 only. 153.It Cm ClientAliveCountMax 154Sets the number of client alive messages (see above) which may be 155sent without 156.Nm sshd 157receiving any messages back from the client. If this threshold is 158reached while client alive messages are being sent, 159.Nm sshd 160will disconnect the client, terminating the session. It is important 161to note that the use of client alive messages is very different from 162.Cm KeepAlive 163(below). The client alive messages are sent through the 164encrypted channel and therefore will not be spoofable. The TCP keepalive 165option enabled by 166.Cm KeepAlive 167is spoofable. The client alive mechanism is valuable when the client or 168server depend on knowing when a connection has become inactive. 169.Pp 170The default value is 3. If 171.Cm ClientAliveInterval 172(above) is set to 15, and 173.Cm ClientAliveCountMax 174is left at the default, unresponsive ssh clients 175will be disconnected after approximately 45 seconds. 176.It Cm Compression 177Specifies whether compression is allowed. 178The argument must be 179.Dq yes 180or 181.Dq no . 182The default is 183.Dq yes . 184.It Cm DenyGroups 185This keyword can be followed by a list of group name patterns, separated 186by spaces. 187Login is disallowed for users whose primary group or supplementary 188group list matches one of the patterns. 189.Ql \&* 190and 191.Ql ? 192can be used as 193wildcards in the patterns. 194Only group names are valid; a numerical group ID is not recognized. 195By default, login is allowed for all groups. 196.Pp 197.It Cm DenyUsers 198This keyword can be followed by a list of user name patterns, separated 199by spaces. 200Login is disallowed for user names that match one of the patterns. 201.Ql \&* 202and 203.Ql ? 204can be used as wildcards in the patterns. 205Only user names are valid; a numerical user ID is not recognized. 206By default, login is allowed for all users. 207If the pattern takes the form USER@HOST then USER and HOST 208are separately checked, restricting logins to particular 209users from particular hosts. 210.It Cm GatewayPorts 211Specifies whether remote hosts are allowed to connect to ports 212forwarded for the client. 213By default, 214.Nm sshd 215binds remote port forwardings to the loopback address. This 216prevents other remote hosts from connecting to forwarded ports. 217.Cm GatewayPorts 218can be used to specify that 219.Nm sshd 220should bind remote port forwardings to the wildcard address, 221thus allowing remote hosts to connect to forwarded ports. 222The argument must be 223.Dq yes 224or 225.Dq no . 226The default is 227.Dq no . 228.It Cm HostbasedAuthentication 229Specifies whether rhosts or /etc/hosts.equiv authentication together 230with successful public key client host authentication is allowed 231(hostbased authentication). 232This option is similar to 233.Cm RhostsRSAAuthentication 234and applies to protocol version 2 only. 235The default is 236.Dq no . 237.It Cm HostKey 238Specifies a file containing a private host key 239used by SSH. 240The default is 241.Pa /etc/ssh/ssh_host_key 242for protocol version 1, and 243.Pa /etc/ssh/ssh_host_dsa_key 244for protocol version 2. 245Note that 246.Nm sshd 247will refuse to use a file if it is group/world-accessible. 248It is possible to have multiple host key files. 249.Dq rsa1 250keys are used for version 1 and 251.Dq dsa 252or 253.Dq rsa 254are used for version 2 of the SSH protocol. 255.It Cm IgnoreRhosts 256Specifies that 257.Pa .rhosts 258and 259.Pa .shosts 260files will not be used in 261.Cm RhostsAuthentication , 262.Cm RhostsRSAAuthentication 263or 264.Cm HostbasedAuthentication . 265.Pp 266.Pa /etc/hosts.equiv 267and 268.Pa /etc/ssh/shosts.equiv 269are still used. 270The default is 271.Dq yes . 272.It Cm IgnoreUserKnownHosts 273Specifies whether 274.Nm sshd 275should ignore the user's 276.Pa $HOME/.ssh/known_hosts 277during 278.Cm RhostsRSAAuthentication 279or 280.Cm HostbasedAuthentication . 281The default is 282.Dq no . 283.It Cm KeepAlive 284Specifies whether the system should send TCP keepalive messages to the 285other side. 286If they are sent, death of the connection or crash of one 287of the machines will be properly noticed. 288However, this means that 289connections will die if the route is down temporarily, and some people 290find it annoying. 291On the other hand, if keepalives are not sent, 292sessions may hang indefinitely on the server, leaving 293.Dq ghost 294users and consuming server resources. 295.Pp 296The default is 297.Dq yes 298(to send keepalives), and the server will notice 299if the network goes down or the client host crashes. 300This avoids infinitely hanging sessions. 301.Pp 302To disable keepalives, the value should be set to 303.Dq no . 304.It Cm KerberosAuthentication 305Specifies whether Kerberos authentication is allowed. 306This can be in the form of a Kerberos ticket, or if 307.Cm PasswordAuthentication 308is yes, the password provided by the user will be validated through 309the Kerberos KDC. 310To use this option, the server needs a 311Kerberos servtab which allows the verification of the KDC's identity. 312Default is 313.Dq no . 314.It Cm KerberosOrLocalPasswd 315If set then if password authentication through Kerberos fails then 316the password will be validated via any additional local mechanism 317such as 318.Pa /etc/passwd . 319Default is 320.Dq yes . 321.It Cm KerberosTgtPassing 322Specifies whether a Kerberos TGT may be forwarded to the server. 323Default is 324.Dq no , 325as this only works when the Kerberos KDC is actually an AFS kaserver. 326.It Cm KerberosTicketCleanup 327Specifies whether to automatically destroy the user's ticket cache 328file on logout. 329Default is 330.Dq yes . 331.It Cm KeyRegenerationInterval 332In protocol version 1, the ephemeral server key is automatically regenerated 333after this many seconds (if it has been used). 334The purpose of regeneration is to prevent 335decrypting captured sessions by later breaking into the machine and 336stealing the keys. 337The key is never stored anywhere. 338If the value is 0, the key is never regenerated. 339The default is 3600 (seconds). 340.It Cm ListenAddress 341Specifies the local addresses 342.Nm sshd 343should listen on. 344The following forms may be used: 345.Pp 346.Bl -item -offset indent -compact 347.It 348.Cm ListenAddress 349.Sm off 350.Ar host No | Ar IPv4_addr No | Ar IPv6_addr 351.Sm on 352.It 353.Cm ListenAddress 354.Sm off 355.Ar host No | Ar IPv4_addr No : Ar port 356.Sm on 357.It 358.Cm ListenAddress 359.Sm off 360.Oo 361.Ar host No | Ar IPv6_addr Oc : Ar port 362.Sm on 363.El 364.Pp 365If 366.Ar port 367is not specified, 368.Nm sshd 369will listen on the address and all prior 370.Cm Port 371options specified. The default is to listen on all local 372addresses. Multiple 373.Cm ListenAddress 374options are permitted. Additionally, any 375.Cm Port 376options must precede this option for non port qualified addresses. 377.It Cm LoginGraceTime 378The server disconnects after this time if the user has not 379successfully logged in. 380If the value is 0, there is no time limit. 381The default is 120 seconds. 382.It Cm LogLevel 383Gives the verbosity level that is used when logging messages from 384.Nm sshd . 385The possible values are: 386QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3. 387The default is INFO. DEBUG and DEBUG1 are equivalent. DEBUG2 388and DEBUG3 each specify higher levels of debugging output. 389Logging with a DEBUG level violates the privacy of users 390and is not recommended. 391.It Cm MACs 392Specifies the available MAC (message authentication code) algorithms. 393The MAC algorithm is used in protocol version 2 394for data integrity protection. 395Multiple algorithms must be comma-separated. 396The default is 397.Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 . 398.It Cm MaxStartups 399Specifies the maximum number of concurrent unauthenticated connections to the 400.Nm sshd 401daemon. 402Additional connections will be dropped until authentication succeeds or the 403.Cm LoginGraceTime 404expires for a connection. 405The default is 10. 406.Pp 407Alternatively, random early drop can be enabled by specifying 408the three colon separated values 409.Dq start:rate:full 410(e.g., "10:30:60"). 411.Nm sshd 412will refuse connection attempts with a probability of 413.Dq rate/100 414(30%) 415if there are currently 416.Dq start 417(10) 418unauthenticated connections. 419The probability increases linearly and all connection attempts 420are refused if the number of unauthenticated connections reaches 421.Dq full 422(60). 423.It Cm PAMAuthenticationViaKbdInt 424Specifies whether PAM challenge response authentication is allowed. This 425allows the use of most PAM challenge response authentication modules, but 426it will allow password authentication regardless of whether 427.Cm PasswordAuthentication 428is enabled. 429.It Cm PasswordAuthentication 430Specifies whether password authentication is allowed. 431The default is 432.Dq yes . 433.It Cm PermitEmptyPasswords 434When password authentication is allowed, it specifies whether the 435server allows login to accounts with empty password strings. 436The default is 437.Dq no . 438.It Cm PermitRootLogin 439Specifies whether root can login using 440.Xr ssh 1 . 441The argument must be 442.Dq yes , 443.Dq without-password , 444.Dq forced-commands-only 445or 446.Dq no . 447The default is 448.Dq no . 449.Pp 450If this option is set to 451.Dq without-password 452password authentication is disabled for root. 453.Pp 454If this option is set to 455.Dq forced-commands-only 456root login with public key authentication will be allowed, 457but only if the 458.Ar command 459option has been specified 460(which may be useful for taking remote backups even if root login is 461normally not allowed). All other authentication methods are disabled 462for root. 463.Pp 464If this option is set to 465.Dq no 466root is not allowed to login. 467.It Cm PermitUserEnvironment 468Specifies whether 469.Pa ~/.ssh/environment 470and 471.Cm environment= 472options in 473.Pa ~/.ssh/authorized_keys 474are processed by 475.Nm sshd . 476The default is 477.Dq no . 478Enabling environment processing may enable users to bypass access 479restrictions in some configurations using mechanisms such as 480.Ev LD_PRELOAD . 481.It Cm PidFile 482Specifies the file that contains the process ID of the 483.Nm sshd 484daemon. 485The default is 486.Pa /var/run/sshd.pid . 487.It Cm Port 488Specifies the port number that 489.Nm sshd 490listens on. 491The default is 22. 492Multiple options of this type are permitted. 493See also 494.Cm ListenAddress . 495.It Cm PrintLastLog 496Specifies whether 497.Nm sshd 498should print the date and time when the user last logged in. 499The default is 500.Dq yes . 501.It Cm PrintMotd 502Specifies whether 503.Nm sshd 504should print 505.Pa /etc/motd 506when a user logs in interactively. 507(On some systems it is also printed by the shell, 508.Pa /etc/profile , 509or equivalent.) 510The default is 511.Dq yes . 512.It Cm Protocol 513Specifies the protocol versions 514.Nm sshd 515supports. 516The possible values are 517.Dq 1 518and 519.Dq 2 . 520Multiple versions must be comma-separated. 521The default is 522.Dq 2,1 . 523Note that the order of the protocol list does not indicate preference, 524because the client selects among multiple protocol versions offered 525by the server. 526Specifying 527.Dq 2,1 528is identical to 529.Dq 1,2 . 530.It Cm PubkeyAuthentication 531Specifies whether public key authentication is allowed. 532The default is 533.Dq yes . 534Note that this option applies to protocol version 2 only. 535.It Cm RhostsAuthentication 536Specifies whether authentication using rhosts or 537.Pa /etc/hosts.equiv 538files is sufficient. 539Normally, this method should not be permitted because it is insecure. 540.Cm RhostsRSAAuthentication 541should be used 542instead, because it performs RSA-based host authentication in addition 543to normal rhosts or 544.Pa /etc/hosts.equiv 545authentication. 546The default is 547.Dq no . 548This option applies to protocol version 1 only. 549.It Cm RhostsRSAAuthentication 550Specifies whether rhosts or 551.Pa /etc/hosts.equiv 552authentication together 553with successful RSA host authentication is allowed. 554The default is 555.Dq no . 556This option applies to protocol version 1 only. 557.It Cm RSAAuthentication 558Specifies whether pure RSA authentication is allowed. 559The default is 560.Dq yes . 561This option applies to protocol version 1 only. 562.It Cm ServerKeyBits 563Defines the number of bits in the ephemeral protocol version 1 server key. 564The minimum value is 512, and the default is 768. 565.It Cm StrictModes 566Specifies whether 567.Nm sshd 568should check file modes and ownership of the 569user's files and home directory before accepting login. 570This is normally desirable because novices sometimes accidentally leave their 571directory or files world-writable. 572The default is 573.Dq yes . 574.It Cm Subsystem 575Configures an external subsystem (e.g., file transfer daemon). 576Arguments should be a subsystem name and a command to execute upon subsystem 577request. 578The command 579.Xr sftp-server 8 580implements the 581.Dq sftp 582file transfer subsystem. 583By default no subsystems are defined. 584Note that this option applies to protocol version 2 only. 585.It Cm SyslogFacility 586Gives the facility code that is used when logging messages from 587.Nm sshd . 588The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2, 589LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. 590The default is AUTH. 591.It Cm UseLogin 592Specifies whether 593.Xr login 1 594is used for interactive login sessions. 595The default is 596.Dq no . 597Note that 598.Xr login 1 599is never used for remote command execution. 600Note also, that if this is enabled, 601.Cm X11Forwarding 602will be disabled because 603.Xr login 1 604does not know how to handle 605.Xr xauth 1 606cookies. If 607.Cm UsePrivilegeSeparation 608is specified, it will be disabled after authentication. 609.It Cm UsePrivilegeSeparation 610Specifies whether 611.Nm sshd 612separates privileges by creating an unprivileged child process 613to deal with incoming network traffic. After successful authentication, 614another process will be created that has the privilege of the authenticated 615user. The goal of privilege separation is to prevent privilege 616escalation by containing any corruption within the unprivileged processes. 617The default is 618.Dq yes . 619.It Cm VerifyReverseMapping 620Specifies whether 621.Nm sshd 622should try to verify the remote host name and check that 623the resolved host name for the remote IP address maps back to the 624very same IP address. 625The default is 626.Dq no . 627.It Cm VersionAddendum 628Specifies a string to append to the regular version string to identify 629OS- or site-specific modifications. 630.It Cm X11DisplayOffset 631Specifies the first display number available for 632.Nm sshd Ns 's 633X11 forwarding. 634This prevents 635.Nm sshd 636from interfering with real X11 servers. 637The default is 10. 638.It Cm X11Forwarding 639Specifies whether X11 forwarding is permitted. 640The argument must be 641.Dq yes 642or 643.Dq no . 644The default is 645.Dq no . 646.Pp 647When X11 forwarding is enabled, there may be additional exposure to 648the server and to client displays if the 649.Nm sshd 650proxy display is configured to listen on the wildcard address (see 651.Cm X11UseLocalhost 652below), however this is not the default. 653Additionally, the authentication spoofing and authentication data 654verification and substitution occur on the client side. 655The security risk of using X11 forwarding is that the client's X11 656display server may be exposed to attack when the ssh client requests 657forwarding (see the warnings for 658.Cm ForwardX11 659in 660.Xr ssh_config 5 ). 661A system administrator may have a stance in which they want to 662protect clients that may expose themselves to attack by unwittingly 663requesting X11 forwarding, which can warrant a 664.Dq no 665setting. 666.Pp 667Note that disabling X11 forwarding does not prevent users from 668forwarding X11 traffic, as users can always install their own forwarders. 669X11 forwarding is automatically disabled if 670.Cm UseLogin 671is enabled. 672.It Cm X11UseLocalhost 673Specifies whether 674.Nm sshd 675should bind the X11 forwarding server to the loopback address or to 676the wildcard address. By default, 677.Nm sshd 678binds the forwarding server to the loopback address and sets the 679hostname part of the 680.Ev DISPLAY 681environment variable to 682.Dq localhost . 683This prevents remote hosts from connecting to the proxy display. 684However, some older X11 clients may not function with this 685configuration. 686.Cm X11UseLocalhost 687may be set to 688.Dq no 689to specify that the forwarding server should be bound to the wildcard 690address. 691The argument must be 692.Dq yes 693or 694.Dq no . 695The default is 696.Dq yes . 697.It Cm XAuthLocation 698Specifies the full pathname of the 699.Xr xauth 1 700program. 701The default is 702.Pa /usr/X11R6/bin/xauth . 703.El 704.Ss Time Formats 705.Pp 706.Nm sshd 707command-line arguments and configuration file options that specify time 708may be expressed using a sequence of the form: 709.Sm off 710.Ar time Op Ar qualifier , 711.Sm on 712where 713.Ar time 714is a positive integer value and 715.Ar qualifier 716is one of the following: 717.Pp 718.Bl -tag -width Ds -compact -offset indent 719.It Cm <none> 720seconds 721.It Cm s | Cm S 722seconds 723.It Cm m | Cm M 724minutes 725.It Cm h | Cm H 726hours 727.It Cm d | Cm D 728days 729.It Cm w | Cm W 730weeks 731.El 732.Pp 733Each member of the sequence is added together to calculate 734the total time value. 735.Pp 736Time format examples: 737.Pp 738.Bl -tag -width Ds -compact -offset indent 739.It 600 740600 seconds (10 minutes) 741.It 10m 74210 minutes 743.It 1h30m 7441 hour 30 minutes (90 minutes) 745.El 746.Sh FILES 747.Bl -tag -width Ds 748.It Pa /etc/ssh/sshd_config 749Contains configuration data for 750.Nm sshd . 751This file should be writable by root only, but it is recommended 752(though not necessary) that it be world-readable. 753.El 754.Sh AUTHORS 755OpenSSH is a derivative of the original and free 756ssh 1.2.12 release by Tatu Ylonen. 757Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 758Theo de Raadt and Dug Song 759removed many bugs, re-added newer features and 760created OpenSSH. 761Markus Friedl contributed the support for SSH 762protocol versions 1.5 and 2.0. 763Niels Provos and Markus Friedl contributed support 764for privilege separation. 765.Sh SEE ALSO 766.Xr sshd 8 767