{"id":353,"date":"2019-10-21T19:56:31","date_gmt":"2019-10-21T17:56:31","guid":{"rendered":"http:\/\/linuxboxen2.dk\/?p=353"},"modified":"2019-10-21T19:56:31","modified_gmt":"2019-10-21T17:56:31","slug":"sshd","status":"publish","type":"post","link":"https:\/\/www.linuxboxen.dk\/?p=353","title":{"rendered":"SSHD"},"content":{"rendered":"<p>SSHD(8)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 BSD System Manager&#8217;s Manual\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SSHD(8)<\/p>\n<p>NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>sshd \u2014 OpenSSH SSH daemon<\/p>\n<p>SYNOPSIS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>sshd [-46DdeiqTt] [-b bits] [-C connection_spec]<br \/>\n[-c host_certificate_file] [-E log_file] [-f config_file]<br \/>\n[-g login_grace_time] [-h host_key_file] [-k key_gen_time]<br \/>\n[-o option] [-p port] [-u len]<\/p>\n<p>DESCRIPTION\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>sshd (OpenSSH Daemon) is the daemon program for ssh(1).\u00a0 Together these<br \/>\nprograms replace rlogin and rsh, and provide secure encrypted communi\u2010<br \/>\ncations between two untrusted hosts over an insecure network.<\/p>\n<p>sshd listens for connections from clients.\u00a0 It is normally started at<br \/>\nboot from \/etc\/rc.\u00a0 It forks a new daemon for each incoming connection.<br \/>\nThe forked daemons handle key exchange, encryption, authentication,<br \/>\ncommand execution, and data exchange.<\/p>\n<p>sshd can be configured using command-line options or a configuration<br \/>\nfile (by default sshd_config(5)); command-line options override values<br \/>\nspecified in the configuration file.\u00a0 sshd rereads its configuration<br \/>\nfile when it receives a hangup signal, SIGHUP, by executing itself with<br \/>\nthe name and options it was started with, e.g. \/usr\/sbin\/sshd.<\/p>\n<p>The options are as follows:<\/p>\n<p>-4\u00a0\u00a0\u00a0\u00a0\u00a0 Forces sshd to use IPv4 addresses only.<\/p>\n<p>-6\u00a0\u00a0\u00a0\u00a0\u00a0 Forces sshd to use IPv6 addresses only.<\/p>\n<p>-b bits<br \/>\nSpecifies the number of bits in the ephemeral protocol version<br \/>\n1 server key (default 1024).<\/p>\n<p>-C connection_spec<br \/>\nSpecify the connection parameters to use for the -T extended<br \/>\ntest mode.\u00a0 If provided, any Match directives in the configura\u2010<br \/>\ntion file that would apply to the specified user, host, and<br \/>\naddress will be set before the configuration is written to<br \/>\nstandard output.\u00a0 The connection parameters are supplied as<br \/>\nkeyword=value pairs.\u00a0 The keywords are \u201cuser\u201d, \u201chost\u201d, \u201claddr\u201d,<br \/>\n\u201clport\u201d, and \u201caddr\u201d.\u00a0 All are required and may be supplied in<br \/>\nany order, either with multiple -C options or as a comma-sepa\u2010<br \/>\nrated list.<\/p>\n<p>-c host_certificate_file<br \/>\nSpecifies a path to a certificate file to identify sshd during<br \/>\nkey exchange.\u00a0 The certificate file must match a host key file<br \/>\nspecified using the -h option or the HostKey configuration<br \/>\ndirective.<\/p>\n<p>-D\u00a0\u00a0\u00a0\u00a0\u00a0 When this option is specified, sshd will not detach and does<br \/>\nnot become a daemon.\u00a0 This allows easy monitoring of sshd.<\/p>\n<p>-d\u00a0\u00a0\u00a0\u00a0\u00a0 Debug mode.\u00a0 The server sends verbose debug output to standard<br \/>\nerror, and does not put itself in the background.\u00a0 The server<br \/>\nalso will not fork and will only process one connection.\u00a0 This<br \/>\noption is only intended for debugging for the server.\u00a0 Multiple<br \/>\n-d options increase the debugging level.\u00a0 Maximum is 3.<\/p>\n<p>-E log_file<br \/>\nAppend debug logs to log_file instead of the system log.<\/p>\n<p>-e\u00a0\u00a0\u00a0\u00a0\u00a0 Write debug logs to standard error instead of the system log.<\/p>\n<p>-f config_file<br \/>\nSpecifies the name of the configuration file.\u00a0 The default is<br \/>\n\/etc\/ssh\/sshd_config.\u00a0 sshd refuses to start if there is no<br \/>\nconfiguration file.<\/p>\n<p>-g login_grace_time<br \/>\nGives the grace time for clients to authenticate themselves<br \/>\n(default 120 seconds).\u00a0 If the client fails to authenticate the<br \/>\nuser within this many seconds, the server disconnects and<br \/>\nexits.\u00a0 A value of zero indicates no limit.<\/p>\n<p>-h host_key_file<br \/>\nSpecifies a file from which a host key is read.\u00a0 This option<br \/>\nmust be given if sshd is not run as root (as the normal host<br \/>\nkey files are normally not readable by anyone but root).\u00a0 The<br \/>\ndefault is \/etc\/ssh\/ssh_host_key for protocol version 1, and<br \/>\n\/etc\/ssh\/ssh_host_dsa_key, \/etc\/ssh\/ssh_host_ecdsa_key.<br \/>\n\/etc\/ssh\/ssh_host_ed25519_key and \/etc\/ssh\/ssh_host_rsa_key for<br \/>\nprotocol version 2.\u00a0 It is possible to have multiple host key<br \/>\nfiles for the different protocol versions and host key algo\u2010<br \/>\nrithms.<\/p>\n<p>-i\u00a0\u00a0\u00a0\u00a0\u00a0 Specifies that sshd is being run from inetd(8).\u00a0 sshd is nor\u2010<br \/>\nmally not run from inetd because it needs to generate the<br \/>\nserver key before it can respond to the client, and this may<br \/>\ntake tens of seconds.\u00a0 Clients would have to wait too long if<br \/>\nthe key was regenerated every time.\u00a0 However, with small key<br \/>\nsizes (e.g. 512) using sshd from inetd may be feasible.<\/p>\n<p>-k key_gen_time<br \/>\nSpecifies how often the ephemeral protocol version 1 server key<br \/>\nis regenerated (default 3600 seconds, or one hour).\u00a0 The moti\u2010<br \/>\nvation for regenerating the key fairly often is that the key is<br \/>\nnot stored anywhere, and after about an hour it becomes impos\u2010<br \/>\nsible to recover the key for decrypting intercepted communica\u2010<br \/>\ntions even if the machine is cracked into or physically seized.<br \/>\nA value of zero indicates that the key will never be regener\u2010<br \/>\nated.<\/p>\n<p>-o option<br \/>\nCan be used to give options in the format used in the configu\u2010<br \/>\nration file.\u00a0 This is useful for specifying options for which<br \/>\nthere is no separate command-line flag.\u00a0 For full details of<br \/>\nthe options, and their values, see sshd_config(5).<\/p>\n<p>-p port<br \/>\nSpecifies the port on which the server listens for connections<br \/>\n(default 22).\u00a0 Multiple port options are permitted.\u00a0 Ports<br \/>\nspecified in the configuration file with the Port option are<br \/>\nignored when a command-line port is specified.\u00a0 Ports specified<br \/>\nusing the ListenAddress option override command-line ports.<\/p>\n<p>-q\u00a0\u00a0\u00a0\u00a0\u00a0 Quiet mode.\u00a0 Nothing is sent to the system log.\u00a0 Normally the<br \/>\nbeginning, authentication, and termination of each connection<br \/>\nis logged.<\/p>\n<p>-T\u00a0\u00a0\u00a0\u00a0\u00a0 Extended test mode.\u00a0 Check the validity of the configuration<br \/>\nfile, output the effective configuration to stdout and then<br \/>\nexit.\u00a0 Optionally, Match rules may be applied by specifying the<br \/>\nconnection parameters using one or more -C options.<\/p>\n<p>-t\u00a0\u00a0\u00a0\u00a0\u00a0 Test mode.\u00a0 Only check the validity of the configuration file<br \/>\nand sanity of the keys.\u00a0 This is useful for updating sshd reli\u2010<br \/>\nably as configuration options may change.<\/p>\n<p>-u len\u00a0 This option is used to specify the size of the field in the<br \/>\nutmp structure that holds the remote host name.\u00a0 If the<br \/>\nresolved host name is longer than len, the dotted decimal value<br \/>\nwill be used instead.\u00a0 This allows hosts with very long host<br \/>\nnames that overflow this field to still be uniquely identified.<br \/>\nSpecifying -u0 indicates that only dotted decimal addresses<br \/>\nshould be put into the utmp file.\u00a0 -u0 may also be used to pre\u2010<br \/>\nvent sshd from making DNS requests unless the authentication<br \/>\nmechanism or configuration requires it.\u00a0 Authentication mecha\u2010<br \/>\nnisms that may require DNS include RhostsRSAAuthentication,<br \/>\nHostbasedAuthentication, and using a from=&#8221;pattern-list&#8221; option<br \/>\nin a key file.\u00a0 Configuration options that require DNS include<br \/>\nusing a\u00a0USER@HOST\u00a0pattern in AllowUsers or DenyUsers.<\/p>\n<p>AUTHENTICATION\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>The OpenSSH SSH daemon supports SSH protocols 1 and 2.\u00a0 The default is<br \/>\nto use protocol 2 only, though this can be changed via the Protocol<br \/>\noption in sshd_config(5).\u00a0 Protocol 2 supports DSA, ECDSA, ED25519 and<br \/>\nRSA keys; protocol 1 only supports RSA keys.\u00a0 For both protocols, each<br \/>\nhost has a host-specific key, normally 2048 bits, used to identify the<br \/>\nhost.<\/p>\n<p>Forward security for protocol 1 is provided through an additional<br \/>\nserver key, normally 768 bits, generated when the server starts.\u00a0 This<br \/>\nkey is normally regenerated every hour if it has been used, and is<br \/>\nnever stored on disk.\u00a0 Whenever a client connects, the daemon responds<br \/>\nwith its public host and server keys.\u00a0 The client compares the RSA host<br \/>\nkey against its own database to verify that it has not changed.\u00a0 The<br \/>\nclient then generates a 256-bit random number.\u00a0 It encrypts this random<br \/>\nnumber using both the host key and the server key, and sends the<br \/>\nencrypted number to the server.\u00a0 Both sides then use this random number<br \/>\nas a session key which is used to encrypt all further communications in<br \/>\nthe session.\u00a0 The rest of the session is encrypted using a conventional<br \/>\ncipher, currently Blowfish or 3DES, with 3DES being used by default.<br \/>\nThe client selects the encryption algorithm to use from those offered<br \/>\nby the server.<\/p>\n<p>For protocol 2, forward security is provided through a Diffie-Hellman<br \/>\nkey agreement.\u00a0 This key agreement results in a shared session key.<br \/>\nThe rest of the session is encrypted using a symmetric cipher, cur\u2010<br \/>\nrently 128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or<br \/>\n256-bit AES.\u00a0 The client selects the encryption algorithm to use from<br \/>\nthose offered by the server.\u00a0 Additionally, session integrity is pro\u2010<br \/>\nvided through a cryptographic message authentication code (hmac-md5,<br \/>\nhmac-sha1, umac-64, umac-128, hmac-ripemd160, hmac-sha2-256 or hmac-<br \/>\nsha2-512).<\/p>\n<p>Finally, the server and the client enter an authentication dialog.\u00a0 The<br \/>\nclient tries to authenticate itself using host-based authentication,<br \/>\npublic key authentication, challenge-response authentication, or pass\u2010<br \/>\nword authentication.<\/p>\n<p>Regardless of the authentication type, the account is checked to ensure<br \/>\nthat it is accessible.\u00a0 An account is not accessible if it is locked,<br \/>\nlisted in DenyUsers or its group is listed in DenyGroups .\u00a0 The defini\u2010<br \/>\ntion of a locked account is system dependant. Some platforms have their<br \/>\nown account database (eg AIX) and some modify the passwd field ( \u2018*LK*\u2019<br \/>\non Solaris and UnixWare, \u2018*\u2019 on HP-UX, containing \u2018Nologin\u2019 on Tru64, a<br \/>\nleading \u2018*LOCKED*\u2019 on FreeBSD and a leading \u2018!\u2019 on most Linuxes).\u00a0 If<br \/>\nthere is a requirement to disable password authentication for the<br \/>\naccount while allowing still public-key, then the passwd field should<br \/>\nbe set to something other than these values (eg \u2018NP\u2019 or \u2018*NP*\u2019 ).<\/p>\n<p>If the client successfully authenticates itself, a dialog for preparing<br \/>\nthe session is entered.\u00a0 At this time the client may request things<br \/>\nlike allocating a pseudo-tty, forwarding X11 connections, forwarding<br \/>\nTCP connections, or forwarding the authentication agent connection over<br \/>\nthe secure channel.<\/p>\n<p>After this, the client either requests a shell or execution of a com\u2010<br \/>\nmand.\u00a0 The sides then enter session mode.\u00a0 In this mode, either side<br \/>\nmay send data at any time, and such data is forwarded to\/from the shell<br \/>\nor command on the server side, and the user terminal in the client<br \/>\nside.<\/p>\n<p>When the user program terminates and all forwarded X11 and other con\u2010<br \/>\nnections have been closed, the server sends command exit status to the<br \/>\nclient, and both sides exit.<\/p>\n<p>LOGIN PROCESS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>When a user successfully logs in, sshd does the following:<\/p>\n<p>1.\u00a0\u00a0 If the login is on a tty, and no command has been specified,<br \/>\nprints last login time and \/etc\/motd (unless prevented in<br \/>\nthe configuration file or by ~\/.hushlogin; see the FILES<br \/>\nsection).<\/p>\n<p>2.\u00a0\u00a0 If the login is on a tty, records login time.<\/p>\n<p>3.\u00a0\u00a0 Checks \/etc\/nologin; if it exists, prints contents and quits<br \/>\n(unless root).<\/p>\n<p>4.\u00a0\u00a0 Changes to run with normal user privileges.<\/p>\n<p>5.\u00a0\u00a0 Sets up basic environment.<\/p>\n<p>6.\u00a0\u00a0 Reads the file ~\/.ssh\/environment, if it exists, and users<br \/>\nare allowed to change their environment.\u00a0 See the<br \/>\nPermitUserEnvironment option in sshd_config(5).<\/p>\n<p>7.\u00a0\u00a0 Changes to user&#8217;s home directory.<\/p>\n<p>8.\u00a0\u00a0 If ~\/.ssh\/rc exists and the sshd_config(5) PermitUserRC<br \/>\noption is set, runs it; else if \/etc\/ssh\/sshrc exists, runs<br \/>\nit; otherwise runs xauth.\u00a0 The \u201crc\u201d files are given the X11<br \/>\nauthentication protocol and cookie in standard input.\u00a0 See<br \/>\nSSHRC, below.<\/p>\n<p>9.\u00a0\u00a0 Runs user&#8217;s shell or command.<\/p>\n<p>SSHRC\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>If the file ~\/.ssh\/rc exists, sh(1) runs it after reading the environ\u2010<br \/>\nment files but before starting the user&#8217;s shell or command.\u00a0 It must<br \/>\nnot produce any output on stdout; stderr must be used instead.\u00a0 If X11<br \/>\nforwarding is in use, it will receive the &#8220;proto cookie&#8221; pair in its<br \/>\nstandard input (and DISPLAY in its environment).\u00a0 The script must call<br \/>\nxauth(1) because sshd will not run xauth automatically to add X11 cook\u2010<br \/>\nies.<\/p>\n<p>The primary purpose of this file is to run any initialization routines<br \/>\nwhich may be needed before the user&#8217;s home directory becomes accessi\u2010<br \/>\nble; AFS is a particular example of such an environment.<\/p>\n<p>This file will probably contain some initialization code followed by<br \/>\nsomething similar to:<\/p>\n<p>if read proto cookie &amp;&amp; [ -n &#8220;$DISPLAY&#8221; ]; then<br \/>\nif [ `echo $DISPLAY | cut -c1-10` = &#8216;localhost:&#8217; ]; then<br \/>\n# X11UseLocalhost=yes<br \/>\necho add unix:`echo $DISPLAY |<br \/>\ncut -c11-` $proto $cookie<br \/>\nelse<br \/>\n# X11UseLocalhost=no<br \/>\necho add $DISPLAY $proto $cookie<br \/>\nfi | xauth -q &#8211;<br \/>\nfi<\/p>\n<p>If this file does not exist, \/etc\/ssh\/sshrc is run, and if that does<br \/>\nnot exist either, xauth is used to add the cookie.<\/p>\n<p>AUTHORIZED_KEYS FILE FORMAT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>AuthorizedKeysFile specifies the files containing public keys for pub\u2010<br \/>\nlic key authentication; if none is specified, the default is<br \/>\n~\/.ssh\/authorized_keys and ~\/.ssh\/authorized_keys2.\u00a0 Each line of the<br \/>\nfile contains one key (empty lines and lines starting with a \u2018#\u2019 are<br \/>\nignored as comments).\u00a0 Protocol 1 public keys consist of the following<br \/>\nspace-separated fields: options, bits, exponent, modulus, comment.<br \/>\nProtocol 2 public key consist of: options, keytype, base64-encoded key,<br \/>\ncomment.\u00a0 The options field is optional; its presence is determined by<br \/>\nwhether the line starts with a number or not (the options field never<br \/>\nstarts with a number).\u00a0 The bits, exponent, modulus, and comment fields<br \/>\ngive the RSA key for protocol version 1; the comment field is not used<br \/>\nfor anything (but may be convenient for the user to identify the key).<br \/>\nFor protocol version 2 the keytype is \u201cecdsa-sha2-nistp256\u201d,<br \/>\n\u201cecdsa-sha2-nistp384\u201d, \u201cecdsa-sha2-nistp521\u201d, \u201cssh-ed25519\u201d, \u201cssh-dss\u201d<br \/>\nor \u201cssh-rsa\u201d.<\/p>\n<p>Note that lines in this file are usually several hundred bytes long<br \/>\n(because of the size of the public key encoding) up to a limit of 8<br \/>\nkilobytes, which permits DSA keys up to 8 kilobits and RSA keys up to<br \/>\n16 kilobits.\u00a0 You don&#8217;t want to type them in; instead, copy the<br \/>\nidentity.pub, id_dsa.pub, id_ecdsa.pub, id_ed25519.pub, or the<br \/>\nid_rsa.pub file and edit it.<\/p>\n<p>sshd enforces a minimum RSA key modulus size for protocol 1 and proto\u2010<br \/>\ncol 2 keys of 768 bits.<\/p>\n<p>The options (if present) consist of comma-separated option specifica\u2010<br \/>\ntions.\u00a0 No spaces are permitted, except within double quotes.\u00a0 The fol\u2010<br \/>\nlowing option specifications are supported (note that option keywords<br \/>\nare case-insensitive):<\/p>\n<p>cert-authority<br \/>\nSpecifies that the listed key is a certification authority (CA)<br \/>\nthat is trusted to validate signed certificates for user<br \/>\nauthentication.<\/p>\n<p>Certificates may encode access restrictions similar to these<br \/>\nkey options.\u00a0 If both certificate restrictions and key options<br \/>\nare present, the most restrictive union of the two is applied.<\/p>\n<p>command=&#8221;command&#8221;<br \/>\nSpecifies that the command is executed whenever this key is<br \/>\nused for authentication.\u00a0 The command supplied by the user (if<br \/>\nany) is ignored.\u00a0 The command is run on a pty if the client<br \/>\nrequests a pty; otherwise it is run without a tty.\u00a0 If an 8-bit<br \/>\nclean channel is required, one must not request a pty or should<br \/>\nspecify no-pty.\u00a0 A quote may be included in the command by<br \/>\nquoting it with a backslash.\u00a0 This option might be useful to<br \/>\nrestrict certain public keys to perform just a specific opera\u2010<br \/>\ntion.\u00a0 An example might be a key that permits remote backups<br \/>\nbut nothing else.\u00a0 Note that the client may specify TCP and\/or<br \/>\nX11 forwarding unless they are explicitly prohibited.\u00a0 The com\u2010<br \/>\nmand originally supplied by the client is available in the<br \/>\nSSH_ORIGINAL_COMMAND environment variable.\u00a0 Note that this<br \/>\noption applies to shell, command or subsystem execution.\u00a0 Also<br \/>\nnote that this command may be superseded by either a<br \/>\nsshd_config(5) ForceCommand directive or a command embedded in<br \/>\na certificate.<\/p>\n<p>environment=&#8221;NAME=value&#8221;<br \/>\nSpecifies that the string is to be added to the environment<br \/>\nwhen logging in using this key.\u00a0 Environment variables set this<br \/>\nway override other default environment values.\u00a0 Multiple<br \/>\noptions of this type are permitted.\u00a0 Environment processing is<br \/>\ndisabled by default and is controlled via the<br \/>\nPermitUserEnvironment option.\u00a0 This option is automatically<br \/>\ndisabled if UseLogin is enabled.<\/p>\n<p>from=&#8221;pattern-list&#8221;<br \/>\nSpecifies that in addition to public key authentication, either<br \/>\nthe canonical name of the remote host or its IP address must be<br \/>\npresent in the comma-separated list of patterns.\u00a0 See PATTERNS<br \/>\nin ssh_config(5) for more information on patterns.<\/p>\n<p>In addition to the wildcard matching that may be applied to<br \/>\nhostnames or addresses, a from stanza may match IP addresses<br \/>\nusing CIDR address\/masklen notation.<\/p>\n<p>The purpose of this option is to optionally increase security:<br \/>\npublic key authentication by itself does not trust the network<br \/>\nor name servers or anything (but the key); however, if somebody<br \/>\nsomehow steals the key, the key permits an intruder to log in<br \/>\nfrom anywhere in the world.\u00a0 This additional option makes using<br \/>\na stolen key more difficult (name servers and\/or routers would<br \/>\nhave to be compromised in addition to just the key).<\/p>\n<p>no-agent-forwarding<br \/>\nForbids authentication agent forwarding when this key is used<br \/>\nfor authentication.<\/p>\n<p>no-port-forwarding<br \/>\nForbids TCP forwarding when this key is used for authentica\u2010<br \/>\ntion.\u00a0 Any port forward requests by the client will return an<br \/>\nerror.\u00a0 This might be used, e.g. in connection with the command<br \/>\noption.<\/p>\n<p>no-pty\u00a0 Prevents tty allocation (a request to allocate a pty will<br \/>\nfail).<\/p>\n<p>no-user-rc<br \/>\nDisables execution of ~\/.ssh\/rc.<\/p>\n<p>no-X11-forwarding<br \/>\nForbids X11 forwarding when this key is used for authentica\u2010<br \/>\ntion.\u00a0 Any X11 forward requests by the client will return an<br \/>\nerror.<\/p>\n<p>permitopen=&#8221;host:port&#8221;<br \/>\nLimit local &#8220;ssh -L&#8221; port forwarding such that it may only<br \/>\nconnect to the specified host and port.\u00a0 IPv6 addresses can be<br \/>\nspecified by enclosing the address in square brackets.\u00a0 Multi\u2010<br \/>\nple permitopen options may be applied separated by commas.\u00a0 No<br \/>\npattern matching is performed on the specified hostnames, they<br \/>\nmust be literal domains or addresses.\u00a0 A port specification of<br \/>\n* matches any port.<\/p>\n<p>principals=&#8221;principals&#8221;<br \/>\nOn a cert-authority line, specifies allowed principals for cer\u2010<br \/>\ntificate authentication as a comma-separated list.\u00a0 At least<br \/>\none name from the list must appear in the certificate&#8217;s list of<br \/>\nprincipals for the certificate to be accepted.\u00a0 This option is<br \/>\nignored for keys that are not marked as trusted certificate<br \/>\nsigners using the cert-authority option.<\/p>\n<p>tunnel=&#8221;n&#8221;<br \/>\nForce a tun(4) device on the server.\u00a0 Without this option, the<br \/>\nnext available device will be used if the client requests a<br \/>\ntunnel.<\/p>\n<p>An example authorized_keys file:<\/p>\n<p># Comments allowed at start of line<br \/>\nssh-rsa AAAAB3Nza&#8230;LiPk==\u00a0user@example.net<br \/>\nfrom=&#8221;*.sales.example.net,!pc.sales.example.net&#8221; ssh-rsa<br \/>\nAAAAB2&#8230;19Q==\u00a0john@example.net<br \/>\ncommand=&#8221;dump \/home&#8221;,no-pty,no-port-forwarding ssh-dss<br \/>\nAAAAC3&#8230;51R== example.net<br \/>\npermitopen=&#8221;192.0.2.1:80&#8243;,permitopen=&#8221;192.0.2.2:25&#8243; ssh-dss<br \/>\nAAAAB5&#8230;21S==<br \/>\ntunnel=&#8221;0&#8243;,command=&#8221;sh \/etc\/netstart tun0&#8243; ssh-rsa AAAA&#8230;==<br \/>\njane@example.net<\/p>\n<p>SSH_KNOWN_HOSTS FILE FORMAT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>The \/etc\/ssh\/ssh_known_hosts and ~\/.ssh\/known_hosts files contain host<br \/>\npublic keys for all known hosts.\u00a0 The global file should be prepared by<br \/>\nthe administrator (optional), and the per-user file is maintained auto\u2010<br \/>\nmatically: whenever the user connects from an unknown host, its key is<br \/>\nadded to the per-user file.<\/p>\n<p>Each line in these files contains the following fields: markers<br \/>\n(optional), hostnames, bits, exponent, modulus, comment.\u00a0 The fields<br \/>\nare separated by spaces.<\/p>\n<p>The marker is optional, but if it is present then it must be one of<br \/>\n\u201c@cert-authority\u201d, to indicate that the line contains a certification<br \/>\nauthority (CA) key, or \u201c@revoked\u201d, to indicate that the key contained<br \/>\non the line is revoked and must not ever be accepted.\u00a0 Only one marker<br \/>\nshould be used on a key line.<\/p>\n<p>Hostnames is a comma-separated list of patterns (\u2018*\u2019 and \u2018?\u2019 act as<br \/>\nwildcards); each pattern in turn is matched against the canonical host<br \/>\nname (when authenticating a client) or against the user-supplied name<br \/>\n(when authenticating a server).\u00a0 A pattern may also be preceded by \u2018!\u2019<br \/>\nto indicate negation: if the host name matches a negated pattern, it is<br \/>\nnot accepted (by that line) even if it matched another pattern on the<br \/>\nline.\u00a0 A hostname or address may optionally be enclosed within \u2018[\u2019 and<br \/>\n\u2018]\u2019 brackets then followed by \u2018:\u2019 and a non-standard port number.<\/p>\n<p>Alternately, hostnames may be stored in a hashed form which hides host<br \/>\nnames and addresses should the file&#8217;s contents be disclosed.\u00a0 Hashed<br \/>\nhostnames start with a \u2018|\u2019 character.\u00a0 Only one hashed hostname may<br \/>\nappear on a single line and none of the above negation or wildcard<br \/>\noperators may be applied.<\/p>\n<p>Bits, exponent, and modulus are taken directly from the RSA host key;<br \/>\nthey can be obtained, for example, from \/etc\/ssh\/ssh_host_key.pub.\u00a0 The<br \/>\noptional comment field continues to the end of the line, and is not<br \/>\nused.<\/p>\n<p>Lines starting with \u2018#\u2019 and empty lines are ignored as comments.<\/p>\n<p>When performing host authentication, authentication is accepted if any<br \/>\nmatching line has the proper key; either one that matches exactly or,<br \/>\nif the server has presented a certificate for authentication, the key<br \/>\nof the certification authority that signed the certificate.\u00a0 For a key<br \/>\nto be trusted as a certification authority, it must use the<br \/>\n\u201c@cert-authority\u201d marker described above.<\/p>\n<p>The known hosts file also provides a facility to mark keys as revoked,<br \/>\nfor example when it is known that the associated private key has been<br \/>\nstolen.\u00a0 Revoked keys are specified by including the \u201c@revoked\u201d marker<br \/>\nat the beginning of the key line, and are never accepted for authenti\u2010<br \/>\ncation or as certification authorities, but instead will produce a<br \/>\nwarning from ssh(1) when they are encountered.<\/p>\n<p>It is permissible (but not recommended) to have several lines or dif\u2010<br \/>\nferent host keys for the same names.\u00a0 This will inevitably happen when<br \/>\nshort forms of host names from different domains are put in the file.<br \/>\nIt is possible that the files contain conflicting information; authen\u2010<br \/>\ntication is accepted if valid information can be found from either<br \/>\nfile.<\/p>\n<p>Note that the lines in these files are typically hundreds of characters<br \/>\nlong, and you definitely don&#8217;t want to type in the host keys by hand.<br \/>\nRather, generate them by a script, ssh-keyscan(1) or by taking<br \/>\n\/etc\/ssh\/ssh_host_key.pub and adding the host names at the front.<br \/>\nssh-keygen(1) also offers some basic automated editing for<br \/>\n~\/.ssh\/known_hosts including removing hosts matching a host name and<br \/>\nconverting all host names to their hashed representations.<\/p>\n<p>An example ssh_known_hosts file:<\/p>\n<p># Comments allowed at start of line<br \/>\nclosenet,&#8230;,192.0.2.53 1024 37 159&#8230;93 closenet.example.net<br \/>\ncvs.example.net,192.0.2.10 ssh-rsa AAAA1234&#8230;..=<br \/>\n# A hashed hostname<br \/>\n|1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa<br \/>\nAAAA1234&#8230;..=<br \/>\n# A revoked key<br \/>\n@revoked * ssh-rsa AAAAB5W&#8230;<br \/>\n# A CA key, accepted for any host in *.mydomain.com or *.mydomain.org<br \/>\n@cert-authority *.mydomain.org,*.mydomain.com ssh-rsa AAAAB5W&#8230;<\/p>\n<p>FILES\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>~\/.hushlogin<br \/>\nThis file is used to suppress printing the last login time and<br \/>\n\/etc\/motd, if PrintLastLog and PrintMotd, respectively, are<br \/>\nenabled.\u00a0 It does not suppress printing of the banner specified<br \/>\nby Banner.<\/p>\n<p>~\/.rhosts<br \/>\nThis file is used for host-based authentication (see ssh(1) for<br \/>\nmore information).\u00a0 On some machines this file may need to be<br \/>\nworld-readable if the user&#8217;s home directory is on an NFS parti\u2010<br \/>\ntion, because sshd reads it as root.\u00a0 Additionally, this file<br \/>\nmust be owned by the user, and must not have write permissions<br \/>\nfor anyone else.\u00a0 The recommended permission for most machines<br \/>\nis read\/write for the user, and not accessible by others.<\/p>\n<p>~\/.shosts<br \/>\nThis file is used in exactly the same way as .rhosts, but<br \/>\nallows host-based authentication without permitting login with<br \/>\nrlogin\/rsh.<\/p>\n<p>~\/.ssh\/<br \/>\nThis directory is the default location for all user-specific<br \/>\nconfiguration and authentication information.\u00a0 There is no gen\u2010<br \/>\neral requirement to keep the entire contents of this directory<br \/>\nsecret, but the recommended permissions are read\/write\/execute<br \/>\nfor the user, and not accessible by others.<\/p>\n<p>~\/.ssh\/authorized_keys<br \/>\nLists the public keys (DSA, ECDSA, ED25519, RSA) that can be<br \/>\nused for logging in as this user.\u00a0 The format of this file is<br \/>\ndescribed above.\u00a0 The content of the file is not highly sensi\u2010<br \/>\ntive, but the recommended permissions are read\/write for the<br \/>\nuser, and not accessible by others.<\/p>\n<p>If this file, the ~\/.ssh directory, or the user&#8217;s home direc\u2010<br \/>\ntory are writable by other users, then the file could be modi\u2010<br \/>\nfied or replaced by unauthorized users.\u00a0 In this case, sshd<br \/>\nwill not allow it to be used unless the StrictModes option has<br \/>\nbeen set to \u201cno\u201d.<\/p>\n<p>~\/.ssh\/environment<br \/>\nThis file is read into the environment at login (if it exists).<br \/>\nIt can only contain empty lines, comment lines (that start with<br \/>\n\u2018#\u2019), and assignment lines of the form name=value.\u00a0 The file<br \/>\nshould be writable only by the user; it need not be readable by<br \/>\nanyone else.\u00a0 Environment processing is disabled by default and<br \/>\nis controlled via the PermitUserEnvironment option.<\/p>\n<p>~\/.ssh\/known_hosts<br \/>\nContains a list of host keys for all hosts the user has logged<br \/>\ninto that are not already in the systemwide list of known host<br \/>\nkeys.\u00a0 The format of this file is described above.\u00a0 This file<br \/>\nshould be writable only by root\/the owner and can, but need not<br \/>\nbe, world-readable.<\/p>\n<p>~\/.ssh\/rc<br \/>\nContains initialization routines to be run before the user&#8217;s<br \/>\nhome directory becomes accessible.\u00a0 This file should be<br \/>\nwritable only by the user, and need not be readable by anyone<br \/>\nelse.<\/p>\n<p>\/etc\/hosts.equiv<br \/>\nThis file is for host-based authentication (see ssh(1)).\u00a0 It<br \/>\nshould only be writable by root.<\/p>\n<p>\/etc\/moduli<br \/>\nContains Diffie-Hellman groups used for the &#8220;Diffie-Hellman<br \/>\nGroup Exchange&#8221;.\u00a0 The file format is described in moduli(5).<\/p>\n<p>\/etc\/motd<br \/>\nSee motd(5).<\/p>\n<p>\/etc\/nologin<br \/>\nIf this file exists, sshd refuses to let anyone except root log<br \/>\nin.\u00a0 The contents of the file are displayed to anyone trying to<br \/>\nlog in, and non-root connections are refused.\u00a0 The file should<br \/>\nbe world-readable.<\/p>\n<p>\/etc\/shosts.equiv<br \/>\nThis file is used in exactly the same way as hosts.equiv, but<br \/>\nallows host-based authentication without permitting login with<br \/>\nrlogin\/rsh.<\/p>\n<p>\/etc\/ssh\/ssh_host_key<br \/>\n\/etc\/ssh\/ssh_host_dsa_key<br \/>\n\/etc\/ssh\/ssh_host_ecdsa_key<br \/>\n\/etc\/ssh\/ssh_host_ed25519_key<br \/>\n\/etc\/ssh\/ssh_host_rsa_key<br \/>\nThese files contain the private parts of the host keys.\u00a0 These<br \/>\nfiles should only be owned by root, readable only by root, and<br \/>\nnot accessible to others.\u00a0 Note that sshd does not start if<br \/>\nthese files are group\/world-accessible.<\/p>\n<p>\/etc\/ssh\/ssh_host_key.pub<br \/>\n\/etc\/ssh\/ssh_host_dsa_key.pub<br \/>\n\/etc\/ssh\/ssh_host_ecdsa_key.pub<br \/>\n\/etc\/ssh\/ssh_host_ed25519_key.pub<br \/>\n\/etc\/ssh\/ssh_host_rsa_key.pub<br \/>\nThese files contain the public parts of the host keys.\u00a0 These<br \/>\nfiles should be world-readable but writable only by root.<br \/>\nTheir contents should match the respective private parts.<br \/>\nThese files are not really used for anything; they are provided<br \/>\nfor the convenience of the user so their contents can be copied<br \/>\nto known hosts files.\u00a0 These files are created using<br \/>\nssh-keygen(1).<\/p>\n<p>\/etc\/ssh\/ssh_known_hosts<br \/>\nSystemwide list of known host keys.\u00a0 This file should be pre\u2010<br \/>\npared by the system administrator to contain the public host<br \/>\nkeys of all machines in the organization.\u00a0 The format of this<br \/>\nfile is described above.\u00a0 This file should be writable only by<br \/>\nroot\/the owner and should be world-readable.<\/p>\n<p>\/etc\/ssh\/sshd_config<br \/>\nContains configuration data for sshd.\u00a0 The file format and con\u2010<br \/>\nfiguration options are described in sshd_config(5).<\/p>\n<p>\/etc\/ssh\/sshrc<br \/>\nSimilar to ~\/.ssh\/rc, it can be used to specify machine-spe\u2010<br \/>\ncific login-time initializations globally.\u00a0 This file should be<br \/>\nwritable only by root, and should be world-readable.<\/p>\n<p>\/var\/empty<br \/>\nchroot(2) directory used by sshd during privilege separation in<br \/>\nthe pre-authentication phase.\u00a0 The directory should not contain<br \/>\nany files and must be owned by root and not group or world-<br \/>\nwritable.<\/p>\n<p>\/var\/run\/sshd.pid<br \/>\nContains the process ID of the sshd listening for connections<br \/>\n(if there are several daemons running concurrently for differ\u2010<br \/>\nent ports, this contains the process ID of the one started<br \/>\nlast).\u00a0 The content of this file is not sensitive; it can be<br \/>\nworld-readable.<\/p>\n<p>SEE ALSO\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>scp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1),<br \/>\nssh-keyscan(1), chroot(2), login.conf(5), moduli(5), sshd_config(5),<br \/>\ninetd(8), sftp-server(8)<\/p>\n<p>AUTHORS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>OpenSSH is a derivative of the original and free ssh 1.2.12 release by<br \/>\nTatu Ylonen.\u00a0 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,<br \/>\nTheo de Raadt and Dug Song removed many bugs, re-added newer features<br \/>\nand created OpenSSH.\u00a0 Markus Friedl contributed the support for SSH<br \/>\nprotocol versions 1.5 and 2.0.\u00a0 Niels Provos and Markus Friedl<br \/>\ncontributed support for privilege separation.<\/p>\n<p>COLOPHON\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top<\/p>\n<p>This page is part of the openssh (Portable OpenSSH) project.\u00a0 Informa\u2010<br \/>\ntion about the project can be found at<br \/>\nhttp:\/\/www.openssh.com\/portable.html.\u00a0 If you have a bug report for<br \/>\nthis manual page, see http:\/\/www.openssh.com\/report.html.\u00a0 This page<br \/>\nwas obtained from the tarball openssh-6.7p1.tar.gz fetched from<br \/>\nhttp:\/\/ftp.eu.openbsd.org\/pub\/OpenBSD\/OpenSSH\/portable\/ on 2014-12-30.<br \/>\nIf you discover any rendering problems in this HTML version of the<br \/>\npage, or you believe there is a better or more up-to-date source for<br \/>\nthe page, or you have corrections or improvements to the information in<br \/>\nthis COLOPHON (which is not part of the original manual page), send a<br \/>\nmail to\u00a0man-pages@man7.org<\/p>\n<p>BSD\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 December 31, 2014\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 BSD<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSHD(8)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 BSD System Manager&#8217;s Manual\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SSHD(8) NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top sshd \u2014 OpenSSH SSH daemon SYNOPSIS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_certificate_file] [-E log_file] [-f config_file] [-g login_grace_time] [-h host_key_file] [-k key_gen_time] [-o option] [-p port] [-u len] DESCRIPTION\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 top sshd (OpenSSH Daemon) is the daemon program for ssh(1).\u00a0 Together these programs replace rlogin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[8],"tags":[],"class_list":["post-353","post","type-post","status-publish","format-standard","hentry","category-shell"],"a3_pvc":{"activated":false,"total_views":0,"today_views":0},"_links":{"self":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=353"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/353\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}