⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sshd.8

📁 OpenSSL Source code for SFTP, SSH, and many others
💻 8
📖 第 1 页 / 共 2 页
字号:
.\"  -*- nroff -*-.\".\" Author: Tatu Ylonen <ylo@cs.hut.fi>.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland.\"                    All rights reserved.\".\" As far as I am concerned, the code I have written for this software.\" can be used freely for any purpose.  Any derived versions of this.\" software must be clearly marked as such, and if the derived work is.\" incompatible with the protocol description in the RFC file, it must be.\" called by a name other than "ssh" or "Secure Shell"..\".\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved..\" Copyright (c) 1999 Aaron Campbell.  All rights reserved..\" Copyright (c) 1999 Theo de Raadt.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\".\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED..\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..\".\" $OpenBSD: sshd.8,v 1.184 2002/06/20 19:56:07 stevesk Exp $.Dd September 25, 1999.Dt SSHD 8.Os.Sh NAME.Nm sshd.Nd OpenSSH SSH daemon.Sh SYNOPSIS.Nm sshd.Op Fl deiqtD46.Op Fl b Ar bits.Op Fl f Ar config_file.Op Fl g Ar login_grace_time.Op Fl h Ar host_key_file.Op Fl k Ar key_gen_time.Op Fl o Ar option.Op Fl p Ar port.Op Fl u Ar len.Sh DESCRIPTION.Nm(SSH Daemon) is the daemon program for.Xr ssh 1 .Together these programs replace rlogin and rsh, andprovide secure encrypted communications between two untrusted hostsover an insecure network.The programs are intended to be as easy toinstall and use as possible..Pp.Nmis the daemon that listens for connections from clients.It is normally started at boot from.Pa /etc/rc .It forks a newdaemon for each incoming connection.The forked daemons handlekey exchange, encryption, authentication, command execution,and data exchange.This implementation of.Nmsupports both SSH protocol version 1 and 2 simultaneously..Nmworks as follows..Pp.Ss SSH protocol version 1.PpEach host has a host-specific RSA key(normally 1024 bits) used to identify the host.Additionally, whenthe daemon starts, it generates a server RSA key (normally 768 bits).This key is normally regenerated every hour if it has been used, andis never stored on disk..PpWhenever a client connects the daemon responds with its publichost and server keys.The client compares theRSA host key against its own database to verify that it has not changed.The client then generates a 256 bit random number.It encrypts thisrandom number using both the host key and the server key, and sendsthe encrypted number to the server.Both sides then use thisrandom number as a session key which is used to encrypt all furthercommunications in the session.The rest of the session is encryptedusing a conventional cipher, currently Blowfish or 3DES, with 3DESbeing used by default.The client selects the encryption algorithmto use from those offered by the server..PpNext, the server and the client enter an authentication dialog.The client tries to authenticate itself using.Pa .rhostsauthentication,.Pa .rhostsauthentication combined with RSA hostauthentication, RSA challenge-response authentication, or passwordbased authentication..PpRhosts authentication is normally disabledbecause it is fundamentally insecure, but can be enabled in the serverconfiguration file if desired.System security is not improved unless.Nm rshd ,.Nm rlogind ,and.Xr rexecdare disabled (thus completely disabling.Xr rloginand.Xr rshinto the machine)..Pp.Ss SSH protocol version 2.PpVersion 2 works similarly:Each host has a host-specific key (RSA or DSA) used to identify the host.However, when the daemon starts, it does not generate a server key.Forward security is provided through a Diffie-Hellman key agreement.This key agreement results in a shared session key..PpThe rest of the session is encrypted using a symmetric cipher, currently128 bit AES, Blowfish, 3DES, CAST128, Arcfour, 192 bit AES, or 256 bit AES.The client selects the encryption algorithmto use from those offered by the server.Additionally, session integrity is providedthrough a cryptographic message authentication code(hmac-sha1 or hmac-md5)..PpProtocol version 2 provides a public key baseduser (PubkeyAuthentication) orclient host (HostbasedAuthentication) authentication method,conventional password authentication and challenge response based methods..Pp.Ss Command execution and data forwarding.PpIf the client successfully authenticates itself, a dialog forpreparing the session is entered.At this time the client may requestthings like allocating a pseudo-tty, forwarding X11 connections,forwarding TCP/IP connections, or forwarding the authentication agentconnection over the secure channel..PpFinally, the client either requests a shell or execution of a command.The sides then enter session mode.In this mode, either side may senddata at any time, and such data is forwarded to/from the shell orcommand on the server side, and the user terminal in the client side..PpWhen the user program terminates and all forwarded X11 and otherconnections have been closed, the server sends command exit status tothe client, and both sides exit..Pp.Nmcan be configured using command-line options or a configurationfile.Command-line options override values specified in theconfiguration file..Pp.Nmrereads its configuration file when it receives a hangup signal,.Dv SIGHUP ,by executing itself with the name it was started as, i.e.,.Pa /usr/sbin/sshd ..PpThe options are as follows:.Bl -tag -width Ds.It Fl b Ar bitsSpecifies the number of bits in the ephemeral protocol version 1server key (default 768)..It Fl dDebug mode.The server sends verbose debug output to the systemlog, and does not put itself in the background.The server also will not fork and will only process one connection.This option is only intended for debugging for the server.Multiple -d options increase the debugging level.Maximum is 3..It Fl eWhen this option is specified,.Nmwill send the output to the standard error instead of the system log..It Fl f Ar configuration_fileSpecifies the name of the configuration file.The default is.Pa /etc/ssh/sshd_config ..Nmrefuses to start if there is no configuration file..It Fl g Ar login_grace_timeGives the grace time for clients to authenticate themselves (default600 seconds).If the client fails to authenticate the user withinthis many seconds, the server disconnects and exits.A value of zero indicates no limit..It Fl h Ar host_key_fileSpecifies a file from which a host key is read.This option must be given if.Nmis not run as root (as the normalhost key files are normally not readable by anyone but root).The default is.Pa /etc/ssh/ssh_host_keyfor protocol version 1, and.Pa /etc/ssh/ssh_host_rsa_keyand.Pa /etc/ssh/ssh_host_dsa_keyfor protocol version 2.It is possible to have multiple host key files forthe different protocol versions and host key algorithms..It Fl iSpecifies that.Nmis being run from inetd..Nmis normally not runfrom inetd because it needs to generate the server key before it canrespond to the client, and this may take tens of seconds.Clients would have to wait too long if the key was regenerated every time.However, with small key sizes (e.g., 512) using.Nmfrom inetd maybe feasible..It Fl k Ar key_gen_timeSpecifies how often the ephemeral protocol version 1 server key isregenerated (default 3600 seconds, or one hour).The motivation for regenerating the key fairlyoften is that the key is not stored anywhere, and after about an hour,it becomes impossible to recover the key for decrypting interceptedcommunications even if the machine is cracked into or physicallyseized.A value of zero indicates that the key will never be regenerated..It Fl o Ar optionCan be used to give options in the format used in the configuration file.This is useful for specifying options for which there is no separatecommand-line flag..It Fl p Ar portSpecifies the port on which the server listens for connections(default 22).Multiple port options are permitted.Ports specified in the configuration file are ignored when acommand-line port is specified..It Fl qQuiet mode.Nothing is sent to the system log.Normally the beginning,authentication, and termination of each connection is logged..It Fl tTest mode.Only check the validity of the configuration file and sanity of the keys.This is useful for updating.Nmreliably as configuration options may change..It Fl u Ar lenThis option is used to specify the size of the fieldin the.Li utmpstructure that holds the remote host name.If the resolved host name is longer than.Ar len ,the dotted decimal value will be used instead.This allows hosts with very long host names thatoverflow this field to still be uniquely identified.Specifying.Fl u0indicates that only dotted decimal addressesshould be put into the.Pa utmpfile..Fl u0is also be used to prevent.Nmfrom making DNS requests unless the authenticationmechanism or configuration requires it.Authentication mechanisms that may require DNS include.Cm RhostsAuthentication ,.Cm RhostsRSAAuthentication ,.Cm HostbasedAuthenticationand using a.Cm from="pattern-list"option in a key file.Configuration options that require DNS include using aUSER@HOST pattern in.Cm AllowUsersor.Cm DenyUsers ..It Fl DWhen this option is specified.Nmwill not detach and does not become a daemon.This allows easy monitoring of.Nm sshd ..It Fl 4Forces.Nmto use IPv4 addresses only..It Fl 6Forces.Nmto use IPv6 addresses only..El.Sh CONFIGURATION FILE.Nmreads configuration data from.Pa /etc/ssh/sshd_config(or the file specified with.Fl fon the command line).The file format and configuration options are described in.Xr sshd_config 5 ..Sh LOGIN PROCESSWhen a user successfully logs in,.Nmdoes the following:.Bl -enum -offset indent.ItIf the login is on a tty, and no command has been specified,prints last login time and.Pa /etc/motd(unless prevented in the configuration file or by.Pa $HOME/.hushlogin ;see the.Sx FILESsection)..ItIf the login is on a tty, records login time..ItChecks.Pa /etc/nologin ;if it exists, prints contents and quits(unless root)..ItChanges to run with normal user privileges..ItSets up basic environment..ItReads.Pa $HOME/.ssh/environmentif it exists..ItChanges to user's home directory..ItIf.Pa $HOME/.ssh/rcexists, runs it; else if.Pa /etc/ssh/sshrcexists, runsit; otherwise runs xauth.The.Dq rcfiles are given the X11authentication protocol and cookie in standard input..ItRuns user's shell or command..El.Sh AUTHORIZED_KEYS FILE FORMAT.Pa $HOME/.ssh/authorized_keysis the default file that lists the public keys that arepermitted for RSA authentication in protocol version 1and for public key authentication (PubkeyAuthentication)in protocol version 2..Cm AuthorizedKeysFilemay be used to specify an alternative file..PpEach line of the file contains onekey (empty lines and lines starting with a.Ql #are ignored ascomments).Each RSA public key consists of the following fields, separated byspaces: options, bits, exponent, modulus, comment.Each protocol version 2 public key consists of:options, keytype, base64 encoded key, comment.The options fieldsare optional; its presence is determined by whether the line startswith a number or not (the option field never starts with a number).The bits, exponent, modulus and comment fields give the RSA key forprotocol version 1; the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -