📄 sshd.8
字号:
.Dq ssh-rsa ..PpNote that lines in this file are usually several hundred bytes long(because of the size of the public key encoding).You don't want to type them in; instead, copy the.Pa identity.pub ,.Pa id_dsa.pubor the.Pa id_rsa.pubfile and edit it..Pp.Nmenforces a minimum RSA key modulus size for protocol 1and protocol 2 keys of 768 bits..PpThe options (if present) consist of comma-separated optionspecifications.No spaces are permitted, except within double quotes.The following option specifications are supported (notethat option keywords are case-insensitive):.Bl -tag -width Ds.It Cm from="pattern-list"Specifies that in addition to public key authentication, the canonical nameof the remote host must be present in the comma-separated list ofpatterns.Pf ( Ql *and.Ql ?serve as wildcards).The list may also containpatterns negated by prefixing them with.Ql ! ;if the canonical host name matches a negated pattern, the key is not accepted.The purposeof this option is to optionally increase security: public key authenticationby itself does not trust the network or name servers or anything (butthe key); however, if somebody somehow steals the key, the keypermits an intruder to log in from anywhere in the world.This additional option makes using a stolen key more difficult (nameservers and/or routers would have to be compromised in addition tojust the key)..It Cm command="command"Specifies that the command is executed whenever this key is used forauthentication.The command supplied by the user (if any) is ignored.The command is run on a pty if the client requests a pty;otherwise it is run without a tty.If an 8-bit clean channel is required,one must not request a pty or should specify.Cm no-pty .A quote may be included in the command by quoting it with a backslash.This option might be usefulto restrict certain public keys to perform just a specific operation.An example might be a key that permits remote backups but nothing else.Note that the client may specify TCP/IP and/or X11forwarding unless they are explicitly prohibited.Note that this option applies to shell, command or subsystem execution..It Cm environment="NAME=value"Specifies that the string is to be added to the environment whenlogging in using this key.Environment variables set this wayoverride other default environment values.Multiple options of this type are permitted.Environment processing is disabled by default and iscontrolled via the.Cm PermitUserEnvironmentoption.This option is automatically disabled if.Cm UseLoginis enabled..It Cm no-port-forwardingForbids TCP/IP forwarding when this key is used for authentication.Any port forward requests by the client will return an error.This might be used, e.g., in connection with the.Cm commandoption..It Cm no-X11-forwardingForbids X11 forwarding when this key is used for authentication.Any X11 forward requests by the client will return an error..It Cm no-agent-forwardingForbids authentication agent forwarding when this key is used forauthentication..It Cm no-ptyPrevents tty allocation (a request to allocate a pty will fail)..It Cm permitopen="host:port"Limit local.Li ``ssh -L''port forwarding such that it may only connect to the specified host andport.IPv6 addresses can be specified with an alternative syntax:.Ar host/port .Multiple.Cm permitopenoptions may be applied separated by commas. No pattern matching isperformed on the specified hostnames, they must be literal domains oraddresses..El.Ss Examples1024 33 12121.\|.\|.\|312314325 ylo@foo.bar.Ppfrom="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23.\|.\|.\|2334 ylo@niksula.Ppcommand="dump /home",no-pty,no-port-forwarding 1024 33 23.\|.\|.\|2323 backup.hut.fi.Pppermitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23.\|.\|.\|2323.Sh SSH_KNOWN_HOSTS FILE FORMATThe.Pa /etc/ssh/ssh_known_hostsand.Pa $HOME/.ssh/known_hostsfiles contain host public keys for all known hosts.The global file shouldbe prepared by the administrator (optional), and the per-user file ismaintained automatically: whenever the user connects from an unknown hostits key is added to the per-user file..PpEach line in these files contains the following fields: hostnames,bits, exponent, modulus, comment.The fields are separated by spaces..PpHostnames is a comma-separated list of patterns ('*' and '?' act aswildcards); each pattern in turn is matched against the canonical hostname (when authenticating a client) or against the user-suppliedname (when authenticating a server).A pattern may also be preceded by.Ql !to indicate negation: if the host name matches a negatedpattern, it is not accepted (by that line) even if it matched anotherpattern on the line..PpBits, exponent, and modulus are taken directly from the RSA host key; theycan be obtained, e.g., from.Pa /etc/ssh/ssh_host_key.pub .The optional comment field continues to the end of the line, and is not used..PpLines starting with.Ql #and empty lines are ignored as comments..PpWhen performing host authentication, authentication is accepted if anymatching line has the proper key.It is thus permissible (but notrecommended) to have several lines or different host keys for the samenames.This will inevitably happen when short forms of host namesfrom different domains are put in the file.It is possiblethat the files contain conflicting information; authentication isaccepted if valid information can be found from either file..PpNote that the lines in these files are typically hundreds of characterslong, and you definitely don't want to type in the host keys by hand.Rather, generate them by a scriptor by taking.Pa /etc/ssh/ssh_host_key.puband adding the host names at the front..Ss Examples.Bd -literalclosenet,.\|.\|.\|,130.233.208.41 1024 37 159.\|.\|.93 closenet.hut.ficvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....=.Ed.Sh FILES.Bl -tag -width Ds.It Pa /etc/ssh/sshd_configContains configuration data for.Nm sshd .The file format and configuration options are described in.Xr sshd_config 5 ..It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_keyThese three files contain the private parts of the host keys.These files should only be owned by root, readable only by root, and notaccessible to others.Note that.Nmdoes not start if this file is group/world-accessible..It Pa /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub, /etc/ssh/ssh_host_rsa_key.pubThese three files contain the public parts of the host keys.These files should be world-readable but writable only byroot.Their contents should match the respective private parts.These files are notreally used for anything; they are provided for the convenience ofthe user so their contents can be copied to known hosts files.These files are created using.Xr ssh-keygen 1 ..It Pa /etc/moduliContains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".The file format is described in.Xr moduli 5 ..It Pa /var/empty.Xr chroot 2directory used by.Nmduring privilege separation in the pre-authentication phase.The directory should not contain any files and must be owned by rootand not group or world-writable..It Pa /var/run/sshd.pidContains the process ID of the.Nmlistening for connections (if there are several daemons runningconcurrently for different ports, this contains the process ID of the onestarted last).The content of this file is not sensitive; it can be world-readable..It Pa $HOME/.ssh/authorized_keysLists the public keys (RSA or DSA) that can be used to log into the user's account.This file must be readable by root (which may on some machines implyit being world-readable if the user's home directory resides on an NFSvolume).It is recommended that it not be accessible by others.The format of this file is described above.Users will place the contents of their.Pa identity.pub ,.Pa id_dsa.puband/or.Pa id_rsa.pubfiles into this file, as described in.Xr ssh-keygen 1 ..It Pa "/etc/ssh/ssh_known_hosts" and "$HOME/.ssh/known_hosts"These files are consulted when using rhosts with RSA hostauthentication or protocol version 2 hostbased authenticationto check the public key of the host.The key must be listed in one of these files to be accepted.The client uses the same filesto verify that it is connecting to the correct remote host.These files should be writable only by root/the owner..Pa /etc/ssh/ssh_known_hostsshould be world-readable, and.Pa $HOME/.ssh/known_hostscan, but need not be, world-readable..It Pa /etc/nologinIf this file exists,.Nmrefuses to let anyone except root log in.The contents of the fileare displayed to anyone trying to log in, and non-root connections arerefused.The file should be world-readable..It Pa /etc/hosts.allow, /etc/hosts.denyAccess controls that should be enforced by tcp-wrappers are defined here.Further details are described in.Xr hosts_access 5 ..It Pa $HOME/.rhostsThis file contains host-username pairs, separated by a space, one perline.The given user on the corresponding host is permitted to log inwithout a password.The same file is used by rlogind and rshd.The file mustbe writable only by the user; it is recommended that it not beaccessible by others..PpIf is also possible to use netgroups in the file.Either host or username may be of the form +@groupname to specify all hosts or all usersin the group..It Pa $HOME/.shostsFor ssh,this file is exactly the same as for.Pa .rhosts .However, this file isnot used by rlogin and rshd, so using this permits access using SSH only..It Pa /etc/hosts.equivThis file is used during.Pa .rhostsauthentication.In the simplest form, this file contains host names, one per line.Users onthose hosts are permitted to log in without a password, provided theyhave the same user name on both machines.The host name may also befollowed by a user name; such users are permitted to log in as.Em anyuser on this machine (except root).Additionally, the syntax.Dq +@groupcan be used to specify netgroups.Negated entries start with.Ql \&- ..PpIf the client host/user is successfully matched in this file, login isautomatically permitted provided the client and server user names are thesame.Additionally, successful RSA host authentication is normally required.This file must be writable only by root; it is recommendedthat it be world-readable..Pp.Sy "Warning: It is almost never a good idea to use user names in".Pa hosts.equiv .Beware that it really means that the named user(s) can log in as.Em anybody ,which includes bin, daemon, adm, and other accounts that own criticalbinaries and directories.Using a user name practically grants the user root access.The only valid use for user names that I can thinkof is in negative entries..PpNote that this warning also applies to rsh/rlogin..It Pa /etc/shosts.equivThis is processed exactly as.Pa /etc/hosts.equiv .However, this file may be useful in environments that want to run bothrsh/rlogin and ssh..It Pa $HOME/.ssh/environmentThis file is read into the environment at login (if it exists).It can only contain empty lines, comment lines (that start with.Ql # ) ,and assignment lines of the form name=value.The file should be writableonly by the user; it need not be readable by anyone else.Environment processing is disabled by default and iscontrolled via the.Cm PermitUserEnvironmentoption..It Pa $HOME/.ssh/rcIf this file exists, it is run with.Pa /bin/shafter reading theenvironment files but before starting the user's shell or command.It must not produce any output on stdout; stderr must be usedinstead.If X11 forwarding is in use, it will receive the "proto cookie" pair inits standard input (and.Ev DISPLAYin its environment).The script must call.Xr xauth 1because.Nmwill not run xauth automatically to add X11 cookies..PpThe primary purpose of this file is to run any initialization routineswhich may be needed before the user's home directory becomesaccessible; AFS is a particular example of such an environment..PpThis file will probably contain some initialization code followed bysomething similar to:.Bd -literalif read proto cookie && [ -n "$DISPLAY" ]; then if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then # X11UseLocalhost=yes echo add unix:`echo $DISPLAY | cut -c11-` $proto $cookie else # X11UseLocalhost=no echo add $DISPLAY $proto $cookie fi | xauth -q -fi.Ed.PpIf this file does not exist,.Pa /etc/ssh/sshrcis run, and if thatdoes not exist either, xauth is used to add the cookie..PpThis file should be writable only by the user, and need not bereadable by anyone else..It Pa /etc/ssh/sshrcLike.Pa $HOME/.ssh/rc .This can be used to specifymachine-specific login-time initializations globally.This file should be writable only by root, and should be world-readable..El.Sh AUTHORSOpenSSH is a derivative of the original and freessh 1.2.12 release by Tatu Ylonen.Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,Theo de Raadt and Dug Songremoved many bugs, re-added newer features andcreated OpenSSH.Markus Friedl contributed the support for SSHprotocol versions 1.5 and 2.0.Niels Provos and Markus Friedl contributed supportfor privilege separation..Sh SEE ALSO.Xr scp 1 ,.Xr sftp 1 ,.Xr ssh 1 ,.Xr ssh-add 1 ,.Xr ssh-agent 1 ,.Xr ssh-keygen 1 ,.Xr login.conf 5 ,.Xr moduli 5 ,.Xr sshd_config 5 ,.Xr sftp-server 8.Rs.%A T. Ylonen.%A T. Kivinen.%A M. Saarinen.%A T. Rinne.%A S. Lehtinen.%T "SSH Protocol Architecture".%N draft-ietf-secsh-architecture-12.txt.%D January 2002.%O work in progress material.Re.Rs.%A M. Friedl.%A N. Provos.%A W. A. Simpson.%T "Diffie-Hellman Group Exchange for the SSH Transport Layer Protocol".%N draft-ietf-secsh-dh-group-exchange-02.txt.%D January 2002.%O work in progress material.Re
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -