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: sshd_config.5,v 1.162 2013/07/19 07:37:48 markus Exp $ 37.\" $FreeBSD$ 38.Dd July 19, 2013 39.Dt SSHD_CONFIG 5 40.Os 41.Sh NAME 42.Nm sshd_config 43.Nd OpenSSH SSH daemon configuration file 44.Sh SYNOPSIS 45.Nm /etc/ssh/sshd_config 46.Sh DESCRIPTION 47.Xr sshd 8 48reads configuration data from 49.Pa /etc/ssh/sshd_config 50(or the file specified with 51.Fl f 52on the command line). 53The file contains keyword-argument pairs, one per line. 54Lines starting with 55.Ql # 56and empty lines are interpreted as comments. 57Arguments may optionally be enclosed in double quotes 58.Pq \&" 59in order to represent arguments containing spaces. 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 AcceptEnv 66Specifies what environment variables sent by the client will be copied into 67the session's 68.Xr environ 7 . 69See 70.Cm SendEnv 71in 72.Xr ssh_config 5 73for how to configure the client. 74Note that environment passing is only supported for protocol 2. 75Variables are specified by name, which may contain the wildcard characters 76.Ql * 77and 78.Ql \&? . 79Multiple environment variables may be separated by whitespace or spread 80across multiple 81.Cm AcceptEnv 82directives. 83Be warned that some environment variables could be used to bypass restricted 84user environments. 85For this reason, care should be taken in the use of this directive. 86The default is not to accept any environment variables. 87.It Cm AddressFamily 88Specifies which address family should be used by 89.Xr sshd 8 . 90Valid arguments are 91.Dq any , 92.Dq inet 93(use IPv4 only), or 94.Dq inet6 95(use IPv6 only). 96The default is 97.Dq any . 98.It Cm AllowAgentForwarding 99Specifies whether 100.Xr ssh-agent 1 101forwarding is permitted. 102The default is 103.Dq yes . 104Note that disabling agent forwarding does not improve security 105unless users are also denied shell access, as they can always install 106their own forwarders. 107.It Cm AllowGroups 108This keyword can be followed by a list of group name patterns, separated 109by spaces. 110If specified, login is allowed only for users whose primary 111group or supplementary group list matches one of the patterns. 112Only group names are valid; a numerical group ID is not recognized. 113By default, login is allowed for all groups. 114The allow/deny directives are processed in the following order: 115.Cm DenyUsers , 116.Cm AllowUsers , 117.Cm DenyGroups , 118and finally 119.Cm AllowGroups . 120.Pp 121See PATTERNS in 122.Xr ssh_config 5 123for more information on patterns. 124.It Cm AllowTcpForwarding 125Specifies whether TCP forwarding is permitted. 126The available options are 127.Dq yes 128or 129.Dq all 130to allow TCP forwarding, 131.Dq no 132to prevent all TCP forwarding, 133.Dq local 134to allow local (from the perspective of 135.Xr ssh 1 ) 136forwarding only or 137.Dq remote 138to allow remote forwarding only. 139The default is 140.Dq yes . 141Note that disabling TCP forwarding does not improve security unless 142users are also denied shell access, as they can always install their 143own forwarders. 144.It Cm AllowUsers 145This keyword can be followed by a list of user name patterns, separated 146by spaces. 147If specified, login is allowed only for user names that 148match one of the patterns. 149Only user names are valid; a numerical user ID is not recognized. 150By default, login is allowed for all users. 151If the pattern takes the form USER@HOST then USER and HOST 152are separately checked, restricting logins to particular 153users from particular hosts. 154The allow/deny directives are processed in the following order: 155.Cm DenyUsers , 156.Cm AllowUsers , 157.Cm DenyGroups , 158and finally 159.Cm AllowGroups . 160.Pp 161See PATTERNS in 162.Xr ssh_config 5 163for more information on patterns. 164.It Cm AuthenticationMethods 165Specifies the authentication methods that must be successfully completed 166for a user to be granted access. 167This option must be followed by one or more comma-separated lists of 168authentication method names. 169Successful authentication requires completion of every method in at least 170one of these lists. 171.Pp 172For example, an argument of 173.Dq publickey,password publickey,keyboard-interactive 174would require the user to complete public key authentication, followed by 175either password or keyboard interactive authentication. 176Only methods that are next in one or more lists are offered at each stage, 177so for this example, it would not be possible to attempt password or 178keyboard-interactive authentication before public key. 179.Pp 180For keyboard interactive authentication it is also possible to 181restrict authentication to a specific device by appending a 182colon followed by the device identifier 183.Dq bsdauth , 184.Dq pam , 185or 186.Dq skey , 187depending on the server configuration. 188For example, 189.Dq keyboard-interactive:bsdauth 190would restrict keyboard interactive authentication to the 191.Dq bsdauth 192device. 193.Pp 194This option is only available for SSH protocol 2 and will yield a fatal 195error if enabled if protocol 1 is also enabled. 196Note that each authentication method listed should also be explicitly enabled 197in the configuration. 198The default is not to require multiple authentication; successful completion 199of a single authentication method is sufficient. 200.It Cm AuthorizedKeysCommand 201Specifies a program to be used to look up the user's public keys. 202The program must be owned by root and not writable by group or others. 203It will be invoked with a single argument of the username 204being authenticated, and should produce on standard output zero or 205more lines of authorized_keys output (see AUTHORIZED_KEYS in 206.Xr sshd 8 ) . 207If a key supplied by AuthorizedKeysCommand does not successfully authenticate 208and authorize the user then public key authentication continues using the usual 209.Cm AuthorizedKeysFile 210files. 211By default, no AuthorizedKeysCommand is run. 212.It Cm AuthorizedKeysCommandUser 213Specifies the user under whose account the AuthorizedKeysCommand is run. 214It is recommended to use a dedicated user that has no other role on the host 215than running authorized keys commands. 216.It Cm AuthorizedKeysFile 217Specifies the file that contains the public keys that can be used 218for user authentication. 219The format is described in the 220AUTHORIZED_KEYS FILE FORMAT 221section of 222.Xr sshd 8 . 223.Cm AuthorizedKeysFile 224may contain tokens of the form %T which are substituted during connection 225setup. 226The following tokens are defined: %% is replaced by a literal '%', 227%h is replaced by the home directory of the user being authenticated, and 228%u is replaced by the username of that user. 229After expansion, 230.Cm AuthorizedKeysFile 231is taken to be an absolute path or one relative to the user's home 232directory. 233Multiple files may be listed, separated by whitespace. 234The default is 235.Dq .ssh/authorized_keys .ssh/authorized_keys2 . 236.It Cm AuthorizedPrincipalsFile 237Specifies a file that lists principal names that are accepted for 238certificate authentication. 239When using certificates signed by a key listed in 240.Cm TrustedUserCAKeys , 241this file lists names, one of which must appear in the certificate for it 242to be accepted for authentication. 243Names are listed one per line preceded by key options (as described 244in AUTHORIZED_KEYS FILE FORMAT in 245.Xr sshd 8 ) . 246Empty lines and comments starting with 247.Ql # 248are ignored. 249.Pp 250.Cm AuthorizedPrincipalsFile 251may contain tokens of the form %T which are substituted during connection 252setup. 253The following tokens are defined: %% is replaced by a literal '%', 254%h is replaced by the home directory of the user being authenticated, and 255%u is replaced by the username of that user. 256After expansion, 257.Cm AuthorizedPrincipalsFile 258is taken to be an absolute path or one relative to the user's home 259directory. 260.Pp 261The default is 262.Dq none , 263i.e. not to use a principals file \(en in this case, the username 264of the user must appear in a certificate's principals list for it to be 265accepted. 266Note that 267.Cm AuthorizedPrincipalsFile 268is only used when authentication proceeds using a CA listed in 269.Cm TrustedUserCAKeys 270and is not consulted for certification authorities trusted via 271.Pa ~/.ssh/authorized_keys , 272though the 273.Cm principals= 274key option offers a similar facility (see 275.Xr sshd 8 276for details). 277.It Cm Banner 278The contents of the specified file are sent to the remote user before 279authentication is allowed. 280If the argument is 281.Dq none 282then no banner is displayed. 283This option is only available for protocol version 2. 284By default, no banner is displayed. 285.It Cm ChallengeResponseAuthentication 286Specifies whether challenge-response authentication is allowed (e.g. via 287PAM or though authentication styles supported in 288.Xr login.conf 5 ) 289The default is 290.Dq yes . 291.It Cm ChrootDirectory 292Specifies the pathname of a directory to 293.Xr chroot 2 294to after authentication. 295All components of the pathname must be root-owned directories that are 296not writable by any other user or group. 297After the chroot, 298.Xr sshd 8 299changes the working directory to the user's home directory. 300.Pp 301The pathname may contain the following tokens that are expanded at runtime once 302the connecting user has been authenticated: %% is replaced by a literal '%', 303%h is replaced by the home directory of the user being authenticated, and 304%u is replaced by the username of that user. 305.Pp 306The 307.Cm ChrootDirectory 308must contain the necessary files and directories to support the 309user's session. 310For an interactive session this requires at least a shell, typically 311.Xr sh 1 , 312and basic 313.Pa /dev 314nodes such as 315.Xr null 4 , 316.Xr zero 4 , 317.Xr stdin 4 , 318.Xr stdout 4 , 319.Xr stderr 4 , 320.Xr arandom 4 321and 322.Xr tty 4 323devices. 324For file transfer sessions using 325.Dq sftp , 326no additional configuration of the environment is necessary if the 327in-process sftp server is used, 328though sessions which use logging do require 329.Pa /dev/log 330inside the chroot directory (see 331.Xr sftp-server 8 332for details). 333.Pp 334The default is not to 335.Xr chroot 2 . 336.It Cm Ciphers 337Specifies the ciphers allowed for protocol version 2. 338Multiple ciphers must be comma-separated. 339The supported ciphers are 340.Dq 3des-cbc , 341.Dq aes128-cbc , 342.Dq aes192-cbc , 343.Dq aes256-cbc , 344.Dq aes128-ctr , 345.Dq aes192-ctr , 346.Dq aes256-ctr , 347.Dq aes128-gcm@openssh.com , 348.Dq aes256-gcm@openssh.com , 349.Dq arcfour128 , 350.Dq arcfour256 , 351.Dq arcfour , 352.Dq blowfish-cbc , 353and 354.Dq cast128-cbc . 355The default is: 356.Bd -literal -offset 3n 357aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128, 358aes128-gcm@openssh.com,aes256-gcm@openssh.com, 359aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc, 360aes256-cbc,arcfour 361.Ed 362.It Cm ClientAliveCountMax 363Sets the number of client alive messages (see below) which may be 364sent without 365.Xr sshd 8 366receiving any messages back from the client. 367If this threshold is reached while client alive messages are being sent, 368sshd will disconnect the client, terminating the session. 369It is important to note that the use of client alive messages is very 370different from 371.Cm TCPKeepAlive 372(below). 373The client alive messages are sent through the encrypted channel 374and therefore will not be spoofable. 375The TCP keepalive option enabled by 376.Cm TCPKeepAlive 377is spoofable. 378The client alive mechanism is valuable when the client or 379server depend on knowing when a connection has become inactive. 380.Pp 381The default value is 3. 382If 383.Cm ClientAliveInterval 384(see below) is set to 15, and 385.Cm ClientAliveCountMax 386is left at the default, unresponsive SSH clients 387will be disconnected after approximately 45 seconds. 388This option applies to protocol version 2 only. 389.It Cm ClientAliveInterval 390Sets a timeout interval in seconds after which if no data has been received 391from the client, 392.Xr sshd 8 393will send a message through the encrypted 394channel to request a response from the client. 395The default 396is 0, indicating that these messages will not be sent to the client. 397This option applies to protocol version 2 only. 398.It Cm Compression 399Specifies whether compression is allowed, or delayed until 400the user has authenticated successfully. 401The argument must be 402.Dq yes , 403.Dq delayed , 404or 405.Dq no . 406The default is 407.Dq delayed . 408.It Cm DenyGroups 409This keyword can be followed by a list of group name patterns, separated 410by spaces. 411Login is disallowed for users whose primary group or supplementary 412group list matches one of the patterns. 413Only group names are valid; a numerical group ID is not recognized. 414By default, login is allowed for all groups. 415The allow/deny directives are processed in the following order: 416.Cm DenyUsers , 417.Cm AllowUsers , 418.Cm DenyGroups , 419and finally 420.Cm AllowGroups . 421.Pp 422See PATTERNS in 423.Xr ssh_config 5 424for more information on patterns. 425.It Cm DenyUsers 426This keyword can be followed by a list of user name patterns, separated 427by spaces. 428Login is disallowed for user names that match one of the patterns. 429Only user names are valid; a numerical user ID is not recognized. 430By default, login is allowed for all users. 431If the pattern takes the form USER@HOST then USER and HOST 432are separately checked, restricting logins to particular 433users from particular hosts. 434The allow/deny directives are processed in the following order: 435.Cm DenyUsers , 436.Cm AllowUsers , 437.Cm DenyGroups , 438and finally 439.Cm AllowGroups . 440.Pp 441See PATTERNS in 442.Xr ssh_config 5 443for more information on patterns. 444.It Cm ForceCommand 445Forces the execution of the command specified by 446.Cm ForceCommand , 447ignoring any command supplied by the client and 448.Pa ~/.ssh/rc 449if present. 450The command is invoked by using the user's login shell with the -c option. 451This applies to shell, command, or subsystem execution. 452It is most useful inside a 453.Cm Match 454block. 455The command originally supplied by the client is available in the 456.Ev SSH_ORIGINAL_COMMAND 457environment variable. 458Specifying a command of 459.Dq internal-sftp 460will force the use of an in-process sftp server that requires no support 461files when used with 462.Cm ChrootDirectory . 463.It Cm GatewayPorts 464Specifies whether remote hosts are allowed to connect to ports 465forwarded for the client. 466By default, 467.Xr sshd 8 468binds remote port forwardings to the loopback address. 469This prevents other remote hosts from connecting to forwarded ports. 470.Cm GatewayPorts 471can be used to specify that sshd 472should allow remote port forwardings to bind to non-loopback addresses, thus 473allowing other hosts to connect. 474The argument may be 475.Dq no 476to force remote port forwardings to be available to the local host only, 477.Dq yes 478to force remote port forwardings to bind to the wildcard address, or 479.Dq clientspecified 480to allow the client to select the address to which the forwarding is bound. 481The default is 482.Dq no . 483.It Cm GSSAPIAuthentication 484Specifies whether user authentication based on GSSAPI is allowed. 485The default is 486.Dq no . 487Note that this option applies to protocol version 2 only. 488.It Cm GSSAPICleanupCredentials 489Specifies whether to automatically destroy the user's credentials cache 490on logout. 491The default is 492.Dq yes . 493Note that this option applies to protocol version 2 only. 494.It Cm HostbasedAuthentication 495Specifies whether rhosts or /etc/hosts.equiv authentication together 496with successful public key client host authentication is allowed 497(host-based authentication). 498This option is similar to 499.Cm RhostsRSAAuthentication 500and applies to protocol version 2 only. 501The default is 502.Dq no . 503.It Cm HostbasedUsesNameFromPacketOnly 504Specifies whether or not the server will attempt to perform a reverse 505name lookup when matching the name in the 506.Pa ~/.shosts , 507.Pa ~/.rhosts , 508and 509.Pa /etc/hosts.equiv 510files during 511.Cm HostbasedAuthentication . 512A setting of 513.Dq yes 514means that 515.Xr sshd 8 516uses the name supplied by the client rather than 517attempting to resolve the name from the TCP connection itself. 518The default is 519.Dq no . 520.It Cm HostCertificate 521Specifies a file containing a public host certificate. 522The certificate's public key must match a private host key already specified 523by 524.Cm HostKey . 525The default behaviour of 526.Xr sshd 8 527is not to load any certificates. 528.It Cm HostKey 529Specifies a file containing a private host key 530used by SSH. 531The default is 532.Pa /etc/ssh/ssh_host_key 533for protocol version 1, and 534.Pa /etc/ssh/ssh_host_dsa_key , 535.Pa /etc/ssh/ssh_host_ecdsa_key 536and 537.Pa /etc/ssh/ssh_host_rsa_key 538for protocol version 2. 539Note that 540.Xr sshd 8 541will refuse to use a file if it is group/world-accessible. 542It is possible to have multiple host key files. 543.Dq rsa1 544keys are used for version 1 and 545.Dq dsa , 546.Dq ecdsa 547or 548.Dq rsa 549are used for version 2 of the SSH protocol. 550It is also possible to specify public host key files instead. 551In this case operations on the private key will be delegated 552to an 553.Xr ssh-agent 1 . 554.It Cm HostKeyAgent 555Identifies the UNIX-domain socket used to communicate 556with an agent that has access to the private host keys. 557If 558.Dq SSH_AUTH_SOCK 559is specified, the location of the socket will be read from the 560.Ev SSH_AUTH_SOCK 561environment variable. 562.It Cm IgnoreRhosts 563Specifies that 564.Pa .rhosts 565and 566.Pa .shosts 567files will not be used in 568.Cm RhostsRSAAuthentication 569or 570.Cm HostbasedAuthentication . 571.Pp 572.Pa /etc/hosts.equiv 573and 574.Pa /etc/ssh/shosts.equiv 575are still used. 576The default is 577.Dq yes . 578.It Cm IgnoreUserKnownHosts 579Specifies whether 580.Xr sshd 8 581should ignore the user's 582.Pa ~/.ssh/known_hosts 583during 584.Cm RhostsRSAAuthentication 585or 586.Cm HostbasedAuthentication . 587The default is 588.Dq no . 589.It Cm IPQoS 590Specifies the IPv4 type-of-service or DSCP class for the connection. 591Accepted values are 592.Dq af11 , 593.Dq af12 , 594.Dq af13 , 595.Dq af21 , 596.Dq af22 , 597.Dq af23 , 598.Dq af31 , 599.Dq af32 , 600.Dq af33 , 601.Dq af41 , 602.Dq af42 , 603.Dq af43 , 604.Dq cs0 , 605.Dq cs1 , 606.Dq cs2 , 607.Dq cs3 , 608.Dq cs4 , 609.Dq cs5 , 610.Dq cs6 , 611.Dq cs7 , 612.Dq ef , 613.Dq lowdelay , 614.Dq throughput , 615.Dq reliability , 616or a numeric value. 617This option may take one or two arguments, separated by whitespace. 618If one argument is specified, it is used as the packet class unconditionally. 619If two values are specified, the first is automatically selected for 620interactive sessions and the second for non-interactive sessions. 621The default is 622.Dq lowdelay 623for interactive sessions and 624.Dq throughput 625for non-interactive sessions. 626.It Cm KerberosAuthentication 627Specifies whether the password provided by the user for 628.Cm PasswordAuthentication 629will be validated through the Kerberos KDC. 630To use this option, the server needs a 631Kerberos servtab which allows the verification of the KDC's identity. 632The default is 633.Dq no . 634.It Cm KerberosGetAFSToken 635If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire 636an AFS token before accessing the user's home directory. 637The default is 638.Dq no . 639.It Cm KerberosOrLocalPasswd 640If password authentication through Kerberos fails then 641the password will be validated via any additional local mechanism 642such as 643.Pa /etc/passwd . 644The default is 645.Dq yes . 646.It Cm KerberosTicketCleanup 647Specifies whether to automatically destroy the user's ticket cache 648file on logout. 649The default is 650.Dq yes . 651.It Cm KexAlgorithms 652Specifies the available KEX (Key Exchange) algorithms. 653Multiple algorithms must be comma-separated. 654The default is 655.Dq ecdh-sha2-nistp256 , 656.Dq ecdh-sha2-nistp384 , 657.Dq ecdh-sha2-nistp521 , 658.Dq diffie-hellman-group-exchange-sha256 , 659.Dq diffie-hellman-group-exchange-sha1 , 660.Dq diffie-hellman-group14-sha1 , 661.Dq diffie-hellman-group1-sha1 . 662.It Cm KeyRegenerationInterval 663In protocol version 1, the ephemeral server key is automatically regenerated 664after this many seconds (if it has been used). 665The purpose of regeneration is to prevent 666decrypting captured sessions by later breaking into the machine and 667stealing the keys. 668The key is never stored anywhere. 669If the value is 0, the key is never regenerated. 670The default is 3600 (seconds). 671.It Cm ListenAddress 672Specifies the local addresses 673.Xr sshd 8 674should listen on. 675The following forms may be used: 676.Pp 677.Bl -item -offset indent -compact 678.It 679.Cm ListenAddress 680.Sm off 681.Ar host No | Ar IPv4_addr No | Ar IPv6_addr 682.Sm on 683.It 684.Cm ListenAddress 685.Sm off 686.Ar host No | Ar IPv4_addr No : Ar port 687.Sm on 688.It 689.Cm ListenAddress 690.Sm off 691.Oo 692.Ar host No | Ar IPv6_addr Oc : Ar port 693.Sm on 694.El 695.Pp 696If 697.Ar port 698is not specified, 699sshd will listen on the address and all prior 700.Cm Port 701options specified. 702The default is to listen on all local addresses. 703Multiple 704.Cm ListenAddress 705options are permitted. 706Additionally, any 707.Cm Port 708options must precede this option for non-port qualified addresses. 709.It Cm LoginGraceTime 710The server disconnects after this time if the user has not 711successfully logged in. 712If the value is 0, there is no time limit. 713The default is 120 seconds. 714.It Cm LogLevel 715Gives the verbosity level that is used when logging messages from 716.Xr sshd 8 . 717The possible values are: 718QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. 719The default is INFO. 720DEBUG and DEBUG1 are equivalent. 721DEBUG2 and DEBUG3 each specify higher levels of debugging output. 722Logging with a DEBUG level violates the privacy of users and is not recommended. 723.It Cm MACs 724Specifies the available MAC (message authentication code) algorithms. 725The MAC algorithm is used in protocol version 2 726for data integrity protection. 727Multiple algorithms must be comma-separated. 728The algorithms that contain 729.Dq -etm 730calculate the MAC after encryption (encrypt-then-mac). 731These are considered safer and their use recommended. 732The default is: 733.Bd -literal -offset indent 734hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com, 735umac-64-etm@openssh.com,umac-128-etm@openssh.com, 736hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com, 737hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com, 738hmac-md5-96-etm@openssh.com, 739hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com, 740hmac-sha2-256,hmac-sha2-512,hmac-ripemd160, 741hmac-sha1-96,hmac-md5-96 742.Ed 743.It Cm Match 744Introduces a conditional block. 745If all of the criteria on the 746.Cm Match 747line are satisfied, the keywords on the following lines override those 748set in the global section of the config file, until either another 749.Cm Match 750line or the end of the file. 751.Pp 752The arguments to 753.Cm Match 754are one or more criteria-pattern pairs. 755The available criteria are 756.Cm User , 757.Cm Group , 758.Cm Host , 759.Cm LocalAddress , 760.Cm LocalPort , 761and 762.Cm Address . 763The match patterns may consist of single entries or comma-separated 764lists and may use the wildcard and negation operators described in the 765PATTERNS section of 766.Xr ssh_config 5 . 767.Pp 768The patterns in an 769.Cm Address 770criteria may additionally contain addresses to match in CIDR 771address/masklen format, e.g.\& 772.Dq 192.0.2.0/24 773or 774.Dq 3ffe:ffff::/32 . 775Note that the mask length provided must be consistent with the address - 776it is an error to specify a mask length that is too long for the address 777or one with bits set in this host portion of the address. 778For example, 779.Dq 192.0.2.0/33 780and 781.Dq 192.0.2.0/8 782respectively. 783.Pp 784Only a subset of keywords may be used on the lines following a 785.Cm Match 786keyword. 787Available keywords are 788.Cm AcceptEnv , 789.Cm AllowAgentForwarding , 790.Cm AllowGroups , 791.Cm AllowTcpForwarding , 792.Cm AllowUsers , 793.Cm AuthenticationMethods , 794.Cm AuthorizedKeysCommand , 795.Cm AuthorizedKeysCommandUser , 796.Cm AuthorizedKeysFile , 797.Cm AuthorizedPrincipalsFile , 798.Cm Banner , 799.Cm ChrootDirectory , 800.Cm DenyGroups , 801.Cm DenyUsers , 802.Cm ForceCommand , 803.Cm GatewayPorts , 804.Cm GSSAPIAuthentication , 805.Cm HostbasedAuthentication , 806.Cm HostbasedUsesNameFromPacketOnly , 807.Cm KbdInteractiveAuthentication , 808.Cm KerberosAuthentication , 809.Cm MaxAuthTries , 810.Cm MaxSessions , 811.Cm PasswordAuthentication , 812.Cm PermitEmptyPasswords , 813.Cm PermitOpen , 814.Cm PermitRootLogin , 815.Cm PermitTunnel , 816.Cm PubkeyAuthentication , 817.Cm RekeyLimit , 818.Cm RhostsRSAAuthentication , 819.Cm RSAAuthentication , 820.Cm X11DisplayOffset , 821.Cm X11Forwarding 822and 823.Cm X11UseLocalHost . 824.It Cm MaxAuthTries 825Specifies the maximum number of authentication attempts permitted per 826connection. 827Once the number of failures reaches half this value, 828additional failures are logged. 829The default is 6. 830.It Cm MaxSessions 831Specifies the maximum number of open sessions permitted per network connection. 832The default is 10. 833.It Cm MaxStartups 834Specifies the maximum number of concurrent unauthenticated connections to the 835SSH daemon. 836Additional connections will be dropped until authentication succeeds or the 837.Cm LoginGraceTime 838expires for a connection. 839The default is 10:30:100. 840.Pp 841Alternatively, random early drop can be enabled by specifying 842the three colon separated values 843.Dq start:rate:full 844(e.g. "10:30:60"). 845.Xr sshd 8 846will refuse connection attempts with a probability of 847.Dq rate/100 848(30%) 849if there are currently 850.Dq start 851(10) 852unauthenticated connections. 853The probability increases linearly and all connection attempts 854are refused if the number of unauthenticated connections reaches 855.Dq full 856(60). 857.It Cm PasswordAuthentication 858Specifies whether password authentication is allowed. 859See also 860.Cm UsePAM . 861The default is 862.Dq no . 863.It Cm PermitEmptyPasswords 864When password authentication is allowed, it specifies whether the 865server allows login to accounts with empty password strings. 866The default is 867.Dq no . 868.It Cm PermitOpen 869Specifies the destinations to which TCP port forwarding is permitted. 870The forwarding specification must be one of the following forms: 871.Pp 872.Bl -item -offset indent -compact 873.It 874.Cm PermitOpen 875.Sm off 876.Ar host : port 877.Sm on 878.It 879.Cm PermitOpen 880.Sm off 881.Ar IPv4_addr : port 882.Sm on 883.It 884.Cm PermitOpen 885.Sm off 886.Ar \&[ IPv6_addr \&] : port 887.Sm on 888.El 889.Pp 890Multiple forwards may be specified by separating them with whitespace. 891An argument of 892.Dq any 893can be used to remove all restrictions and permit any forwarding requests. 894An argument of 895.Dq none 896can be used to prohibit all forwarding requests. 897By default all port forwarding requests are permitted. 898.It Cm PermitRootLogin 899Specifies whether root can log in using 900.Xr ssh 1 . 901The argument must be 902.Dq yes , 903.Dq without-password , 904.Dq forced-commands-only , 905or 906.Dq no . 907The default is 908.Dq no . 909Note that if 910.Cm ChallengeResponseAuthentication 911is 912.Dq yes , 913the root user may be allowed in with its password even if 914.Cm PermitRootLogin is set to 915.Dq without-password . 916.Pp 917If this option is set to 918.Dq without-password , 919password authentication is disabled for root. 920.Pp 921If this option is set to 922.Dq forced-commands-only , 923root login with public key authentication will be allowed, 924but only if the 925.Ar command 926option has been specified 927(which may be useful for taking remote backups even if root login is 928normally not allowed). 929All other authentication methods are disabled for root. 930.Pp 931If this option is set to 932.Dq no , 933root is not allowed to log in. 934.It Cm PermitTunnel 935Specifies whether 936.Xr tun 4 937device forwarding is allowed. 938The argument must be 939.Dq yes , 940.Dq point-to-point 941(layer 3), 942.Dq ethernet 943(layer 2), or 944.Dq no . 945Specifying 946.Dq yes 947permits both 948.Dq point-to-point 949and 950.Dq ethernet . 951The default is 952.Dq no . 953.It Cm PermitUserEnvironment 954Specifies whether 955.Pa ~/.ssh/environment 956and 957.Cm environment= 958options in 959.Pa ~/.ssh/authorized_keys 960are processed by 961.Xr sshd 8 . 962The default is 963.Dq no . 964Enabling environment processing may enable users to bypass access 965restrictions in some configurations using mechanisms such as 966.Ev LD_PRELOAD . 967.It Cm PidFile 968Specifies the file that contains the process ID of the 969SSH daemon. 970The default is 971.Pa /var/run/sshd.pid . 972.It Cm Port 973Specifies the port number that 974.Xr sshd 8 975listens on. 976The default is 22. 977Multiple options of this type are permitted. 978See also 979.Cm ListenAddress . 980.It Cm PrintLastLog 981Specifies whether 982.Xr sshd 8 983should print the date and time of the last user login when a user logs 984in interactively. 985The default is 986.Dq yes . 987.It Cm PrintMotd 988Specifies whether 989.Xr sshd 8 990should print 991.Pa /etc/motd 992when a user logs in interactively. 993(On some systems it is also printed by the shell, 994.Pa /etc/profile , 995or equivalent.) 996The default is 997.Dq yes . 998.It Cm Protocol 999Specifies the protocol versions 1000.Xr sshd 8 1001supports. 1002The possible values are 1003.Sq 1 1004and 1005.Sq 2 . 1006Multiple versions must be comma-separated. 1007The default is 1008.Sq 2 . 1009Note that the order of the protocol list does not indicate preference, 1010because the client selects among multiple protocol versions offered 1011by the server. 1012Specifying 1013.Dq 2,1 1014is identical to 1015.Dq 1,2 . 1016.It Cm PubkeyAuthentication 1017Specifies whether public key authentication is allowed. 1018The default is 1019.Dq yes . 1020Note that this option applies to protocol version 2 only. 1021.It Cm RekeyLimit 1022Specifies the maximum amount of data that may be transmitted before the 1023session key is renegotiated, optionally followed a maximum amount of 1024time that may pass before the session key is renegotiated. 1025The first argument is specified in bytes and may have a suffix of 1026.Sq K , 1027.Sq M , 1028or 1029.Sq G 1030to indicate Kilobytes, Megabytes, or Gigabytes, respectively. 1031The default is between 1032.Sq 1G 1033and 1034.Sq 4G , 1035depending on the cipher. 1036The optional second value is specified in seconds and may use any of the 1037units documented in the 1038.Sx TIME FORMATS 1039section. 1040The default value for 1041.Cm RekeyLimit 1042is 1043.Dq default none , 1044which means that rekeying is performed after the cipher's default amount 1045of data has been sent or received and no time based rekeying is done. 1046This option applies to protocol version 2 only. 1047.It Cm RevokedKeys 1048Specifies revoked public keys. 1049Keys listed in this file will be refused for public key authentication. 1050Note that if this file is not readable, then public key authentication will 1051be refused for all users. 1052Keys may be specified as a text file, listing one public key per line, or as 1053an OpenSSH Key Revocation List (KRL) as generated by 1054.Xr ssh-keygen 1 . 1055For more information on KRLs, see the KEY REVOCATION LISTS section in 1056.Xr ssh-keygen 1 . 1057.It Cm RhostsRSAAuthentication 1058Specifies whether rhosts or 1059.Pa /etc/hosts.equiv 1060authentication together 1061with successful RSA host authentication is allowed. 1062The default is 1063.Dq no . 1064This option applies to protocol version 1 only. 1065.It Cm RSAAuthentication 1066Specifies whether pure RSA authentication is allowed. 1067The default is 1068.Dq yes . 1069This option applies to protocol version 1 only. 1070.It Cm ServerKeyBits 1071Defines the number of bits in the ephemeral protocol version 1 server key. 1072The minimum value is 512, and the default is 1024. 1073.It Cm StrictModes 1074Specifies whether 1075.Xr sshd 8 1076should check file modes and ownership of the 1077user's files and home directory before accepting login. 1078This is normally desirable because novices sometimes accidentally leave their 1079directory or files world-writable. 1080The default is 1081.Dq yes . 1082Note that this does not apply to 1083.Cm ChrootDirectory , 1084whose permissions and ownership are checked unconditionally. 1085.It Cm Subsystem 1086Configures an external subsystem (e.g. file transfer daemon). 1087Arguments should be a subsystem name and a command (with optional arguments) 1088to execute upon subsystem request. 1089.Pp 1090The command 1091.Xr sftp-server 8 1092implements the 1093.Dq sftp 1094file transfer subsystem. 1095.Pp 1096Alternately the name 1097.Dq internal-sftp 1098implements an in-process 1099.Dq sftp 1100server. 1101This may simplify configurations using 1102.Cm ChrootDirectory 1103to force a different filesystem root on clients. 1104.Pp 1105By default no subsystems are defined. 1106Note that this option applies to protocol version 2 only. 1107.It Cm SyslogFacility 1108Gives the facility code that is used when logging messages from 1109.Xr sshd 8 . 1110The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2, 1111LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. 1112The default is AUTH. 1113.It Cm TCPKeepAlive 1114Specifies whether the system should send TCP keepalive messages to the 1115other side. 1116If they are sent, death of the connection or crash of one 1117of the machines will be properly noticed. 1118However, this means that 1119connections will die if the route is down temporarily, and some people 1120find it annoying. 1121On the other hand, if TCP keepalives are not sent, 1122sessions may hang indefinitely on the server, leaving 1123.Dq ghost 1124users and consuming server resources. 1125.Pp 1126The default is 1127.Dq yes 1128(to send TCP keepalive messages), and the server will notice 1129if the network goes down or the client host crashes. 1130This avoids infinitely hanging sessions. 1131.Pp 1132To disable TCP keepalive messages, the value should be set to 1133.Dq no . 1134.It Cm TrustedUserCAKeys 1135Specifies a file containing public keys of certificate authorities that are 1136trusted to sign user certificates for authentication. 1137Keys are listed one per line; empty lines and comments starting with 1138.Ql # 1139are allowed. 1140If a certificate is presented for authentication and has its signing CA key 1141listed in this file, then it may be used for authentication for any user 1142listed in the certificate's principals list. 1143Note that certificates that lack a list of principals will not be permitted 1144for authentication using 1145.Cm TrustedUserCAKeys . 1146For more details on certificates, see the CERTIFICATES section in 1147.Xr ssh-keygen 1 . 1148.It Cm UseDNS 1149Specifies whether 1150.Xr sshd 8 1151should look up the remote host name and check that 1152the resolved host name for the remote IP address maps back to the 1153very same IP address. 1154The default is 1155.Dq yes . 1156.It Cm UseLogin 1157Specifies whether 1158.Xr login 1 1159is used for interactive login sessions. 1160The default is 1161.Dq no . 1162Note that 1163.Xr login 1 1164is never used for remote command execution. 1165Note also, that if this is enabled, 1166.Cm X11Forwarding 1167will be disabled because 1168.Xr login 1 1169does not know how to handle 1170.Xr xauth 1 1171cookies. 1172If 1173.Cm UsePrivilegeSeparation 1174is specified, it will be disabled after authentication. 1175.It Cm UsePAM 1176Enables the Pluggable Authentication Module interface. 1177If set to 1178.Dq yes 1179this will enable PAM authentication using 1180.Cm ChallengeResponseAuthentication 1181and 1182.Cm PasswordAuthentication 1183in addition to PAM account and session module processing for all 1184authentication types. 1185.Pp 1186Because PAM challenge-response authentication usually serves an equivalent 1187role to password authentication, you should disable either 1188.Cm PasswordAuthentication 1189or 1190.Cm ChallengeResponseAuthentication. 1191.Pp 1192If 1193.Cm UsePAM 1194is enabled, you will not be able to run 1195.Xr sshd 8 1196as a non-root user. 1197The default is 1198.Dq yes . 1199.It Cm UsePrivilegeSeparation 1200Specifies whether 1201.Xr sshd 8 1202separates privileges by creating an unprivileged child process 1203to deal with incoming network traffic. 1204After successful authentication, another process will be created that has 1205the privilege of the authenticated user. 1206The goal of privilege separation is to prevent privilege 1207escalation by containing any corruption within the unprivileged processes. 1208The default is 1209.Dq yes . 1210If 1211.Cm UsePrivilegeSeparation 1212is set to 1213.Dq sandbox 1214then the pre-authentication unprivileged process is subject to additional 1215restrictions. 1216.It Cm VersionAddendum 1217Optionally specifies additional text to append to the SSH protocol banner 1218sent by the server upon connection. 1219The default is 1220.Dq FreeBSD-20131111 . 1221.It Cm X11DisplayOffset 1222Specifies the first display number available for 1223.Xr sshd 8 Ns 's 1224X11 forwarding. 1225This prevents sshd from interfering with real X11 servers. 1226The default is 10. 1227.It Cm X11Forwarding 1228Specifies whether X11 forwarding is permitted. 1229The argument must be 1230.Dq yes 1231or 1232.Dq no . 1233The default is 1234.Dq yes . 1235.Pp 1236When X11 forwarding is enabled, there may be additional exposure to 1237the server and to client displays if the 1238.Xr sshd 8 1239proxy display is configured to listen on the wildcard address (see 1240.Cm X11UseLocalhost 1241below), though this is not the default. 1242Additionally, the authentication spoofing and authentication data 1243verification and substitution occur on the client side. 1244The security risk of using X11 forwarding is that the client's X11 1245display server may be exposed to attack when the SSH client requests 1246forwarding (see the warnings for 1247.Cm ForwardX11 1248in 1249.Xr ssh_config 5 ) . 1250A system administrator may have a stance in which they want to 1251protect clients that may expose themselves to attack by unwittingly 1252requesting X11 forwarding, which can warrant a 1253.Dq no 1254setting. 1255.Pp 1256Note that disabling X11 forwarding does not prevent users from 1257forwarding X11 traffic, as users can always install their own forwarders. 1258X11 forwarding is automatically disabled if 1259.Cm UseLogin 1260is enabled. 1261.It Cm X11UseLocalhost 1262Specifies whether 1263.Xr sshd 8 1264should bind the X11 forwarding server to the loopback address or to 1265the wildcard address. 1266By default, 1267sshd binds the forwarding server to the loopback address and sets the 1268hostname part of the 1269.Ev DISPLAY 1270environment variable to 1271.Dq localhost . 1272This prevents remote hosts from connecting to the proxy display. 1273However, some older X11 clients may not function with this 1274configuration. 1275.Cm X11UseLocalhost 1276may be set to 1277.Dq no 1278to specify that the forwarding server should be bound to the wildcard 1279address. 1280The argument must be 1281.Dq yes 1282or 1283.Dq no . 1284The default is 1285.Dq yes . 1286.It Cm XAuthLocation 1287Specifies the full pathname of the 1288.Xr xauth 1 1289program. 1290The default is 1291.Pa /usr/local/bin/xauth . 1292.El 1293.Sh TIME FORMATS 1294.Xr sshd 8 1295command-line arguments and configuration file options that specify time 1296may be expressed using a sequence of the form: 1297.Sm off 1298.Ar time Op Ar qualifier , 1299.Sm on 1300where 1301.Ar time 1302is a positive integer value and 1303.Ar qualifier 1304is one of the following: 1305.Pp 1306.Bl -tag -width Ds -compact -offset indent 1307.It Aq Cm none 1308seconds 1309.It Cm s | Cm S 1310seconds 1311.It Cm m | Cm M 1312minutes 1313.It Cm h | Cm H 1314hours 1315.It Cm d | Cm D 1316days 1317.It Cm w | Cm W 1318weeks 1319.El 1320.Pp 1321Each member of the sequence is added together to calculate 1322the total time value. 1323.Pp 1324Time format examples: 1325.Pp 1326.Bl -tag -width Ds -compact -offset indent 1327.It 600 1328600 seconds (10 minutes) 1329.It 10m 133010 minutes 1331.It 1h30m 13321 hour 30 minutes (90 minutes) 1333.El 1334.Sh FILES 1335.Bl -tag -width Ds 1336.It Pa /etc/ssh/sshd_config 1337Contains configuration data for 1338.Xr sshd 8 . 1339This file should be writable by root only, but it is recommended 1340(though not necessary) that it be world-readable. 1341.El 1342.Sh SEE ALSO 1343.Xr sshd 8 1344.Sh AUTHORS 1345OpenSSH is a derivative of the original and free 1346ssh 1.2.12 release by Tatu Ylonen. 1347Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 1348Theo de Raadt and Dug Song 1349removed many bugs, re-added newer features and 1350created OpenSSH. 1351Markus Friedl contributed the support for SSH 1352protocol versions 1.5 and 2.0. 1353Niels Provos and Markus Friedl contributed support 1354for privilege separation. 1355