xref: /freebsd/crypto/openssh/sshd.8 (revision 7aee6ffee0748c4c6bd9d11bb2a90c7531244d63)
1511b41d2SMark Murray.\"  -*- nroff -*-
2511b41d2SMark Murray.\"
3511b41d2SMark Murray.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4511b41d2SMark Murray.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5511b41d2SMark Murray.\"                    All rights reserved
6511b41d2SMark Murray.\"
7c2d3a559SKris Kennaway.\" As far as I am concerned, the code I have written for this software
8c2d3a559SKris Kennaway.\" can be used freely for any purpose.  Any derived versions of this
9c2d3a559SKris Kennaway.\" software must be clearly marked as such, and if the derived work is
10c2d3a559SKris Kennaway.\" incompatible with the protocol description in the RFC file, it must be
11c2d3a559SKris Kennaway.\" called by a name other than "ssh" or "Secure Shell".
12511b41d2SMark Murray.\"
13c2d3a559SKris Kennaway.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
14c2d3a559SKris Kennaway.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
15c2d3a559SKris Kennaway.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
16c2d3a559SKris Kennaway.\"
17c2d3a559SKris Kennaway.\" Redistribution and use in source and binary forms, with or without
18c2d3a559SKris Kennaway.\" modification, are permitted provided that the following conditions
19c2d3a559SKris Kennaway.\" are met:
20c2d3a559SKris Kennaway.\" 1. Redistributions of source code must retain the above copyright
21c2d3a559SKris Kennaway.\"    notice, this list of conditions and the following disclaimer.
22c2d3a559SKris Kennaway.\" 2. Redistributions in binary form must reproduce the above copyright
23c2d3a559SKris Kennaway.\"    notice, this list of conditions and the following disclaimer in the
24c2d3a559SKris Kennaway.\"    documentation and/or other materials provided with the distribution.
25c2d3a559SKris Kennaway.\"
26c2d3a559SKris Kennaway.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27c2d3a559SKris Kennaway.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28c2d3a559SKris Kennaway.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29c2d3a559SKris Kennaway.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30c2d3a559SKris Kennaway.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31c2d3a559SKris Kennaway.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32c2d3a559SKris Kennaway.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33c2d3a559SKris Kennaway.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34c2d3a559SKris Kennaway.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35c2d3a559SKris Kennaway.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36c2d3a559SKris Kennaway.\"
377aee6ffeSDag-Erling Smørgrav.\" $OpenBSD: sshd.8,v 1.248 2009/03/26 08:38:39 sobrado Exp $
3835d4ccfbSDag-Erling Smørgrav.\" $FreeBSD$
397aee6ffeSDag-Erling Smørgrav.Dd March 26 2009
40511b41d2SMark Murray.Dt SSHD 8
41511b41d2SMark Murray.Os
42511b41d2SMark Murray.Sh NAME
43511b41d2SMark Murray.Nm sshd
44ca3176e7SBrian Feldman.Nd OpenSSH SSH daemon
45511b41d2SMark Murray.Sh SYNOPSIS
46511b41d2SMark Murray.Nm sshd
47e73e9afaSDag-Erling Smørgrav.Bk -words
48d4af9e69SDag-Erling Smørgrav.Op Fl 46DdeiqTt
49511b41d2SMark Murray.Op Fl b Ar bits
50d4af9e69SDag-Erling Smørgrav.Op Fl C Ar connection_spec
51511b41d2SMark Murray.Op Fl f Ar config_file
52511b41d2SMark Murray.Op Fl g Ar login_grace_time
53511b41d2SMark Murray.Op Fl h Ar host_key_file
54511b41d2SMark Murray.Op Fl k Ar key_gen_time
55af12a3e7SDag-Erling Smørgrav.Op Fl o Ar option
56511b41d2SMark Murray.Op Fl p Ar port
57c2d3a559SKris Kennaway.Op Fl u Ar len
58e73e9afaSDag-Erling Smørgrav.Ek
59511b41d2SMark Murray.Sh DESCRIPTION
60511b41d2SMark Murray.Nm
61b74df5b2SDag-Erling Smørgrav(OpenSSH Daemon) is the daemon program for
62511b41d2SMark Murray.Xr ssh 1 .
63d4af9e69SDag-Erling SmørgravTogether these programs replace
64d4af9e69SDag-Erling Smørgrav.Xr rlogin 1
65d4af9e69SDag-Erling Smørgravand
66d4af9e69SDag-Erling Smørgrav.Xr rsh 1 ,
67d4af9e69SDag-Erling Smørgravand provide secure encrypted communications between two untrusted hosts
683c6ae118SKris Kennawayover an insecure network.
69511b41d2SMark Murray.Pp
70511b41d2SMark Murray.Nm
71b74df5b2SDag-Erling Smørgravlistens for connections from clients.
723c6ae118SKris KennawayIt is normally started at boot from
7335d4ccfbSDag-Erling Smørgrav.Pa /etc/rc.d/sshd .
74511b41d2SMark MurrayIt forks a new
753c6ae118SKris Kennawaydaemon for each incoming connection.
763c6ae118SKris KennawayThe forked daemons handle
77511b41d2SMark Murraykey exchange, encryption, authentication, command execution,
78511b41d2SMark Murrayand data exchange.
79511b41d2SMark Murray.Pp
80511b41d2SMark Murray.Nm
811ec0d754SDag-Erling Smørgravcan be configured using command-line options or a configuration file
821ec0d754SDag-Erling Smørgrav(by default
83b74df5b2SDag-Erling Smørgrav.Xr sshd_config 5 ) ;
84b74df5b2SDag-Erling Smørgravcommand-line options override values specified in the
85511b41d2SMark Murrayconfiguration file.
86511b41d2SMark Murray.Nm
87511b41d2SMark Murrayrereads its configuration file when it receives a hangup signal,
88ca3176e7SBrian Feldman.Dv SIGHUP ,
89333ee039SDag-Erling Smørgravby executing itself with the name and options it was started with, e.g.\&
90ca3176e7SBrian Feldman.Pa /usr/sbin/sshd .
91511b41d2SMark Murray.Pp
92511b41d2SMark MurrayThe options are as follows:
93511b41d2SMark Murray.Bl -tag -width Ds
941ec0d754SDag-Erling Smørgrav.It Fl 4
951ec0d754SDag-Erling SmørgravForces
961ec0d754SDag-Erling Smørgrav.Nm
971ec0d754SDag-Erling Smørgravto use IPv4 addresses only.
981ec0d754SDag-Erling Smørgrav.It Fl 6
991ec0d754SDag-Erling SmørgravForces
1001ec0d754SDag-Erling Smørgrav.Nm
1011ec0d754SDag-Erling Smørgravto use IPv6 addresses only.
102511b41d2SMark Murray.It Fl b Ar bits
103ca3176e7SBrian FeldmanSpecifies the number of bits in the ephemeral protocol version 1
104d4af9e69SDag-Erling Smørgravserver key (default 1024).
105d4af9e69SDag-Erling Smørgrav.It Fl C Ar connection_spec
106d4af9e69SDag-Erling SmørgravSpecify the connection parameters to use for the
107d4af9e69SDag-Erling Smørgrav.Fl T
108d4af9e69SDag-Erling Smørgravextended test mode.
109d4af9e69SDag-Erling SmørgravIf provided, any
110d4af9e69SDag-Erling Smørgrav.Cm Match
111d4af9e69SDag-Erling Smørgravdirectives in the configuration file
112d4af9e69SDag-Erling Smørgravthat would apply to the specified user, host, and address will be set before
113d4af9e69SDag-Erling Smørgravthe configuration is written to standard output.
114d4af9e69SDag-Erling SmørgravThe connection parameters are supplied as keyword=value pairs.
115d4af9e69SDag-Erling SmørgravThe keywords are
116d4af9e69SDag-Erling Smørgrav.Dq user ,
117d4af9e69SDag-Erling Smørgrav.Dq host ,
118d4af9e69SDag-Erling Smørgravand
119d4af9e69SDag-Erling Smørgrav.Dq addr .
120d4af9e69SDag-Erling SmørgravAll are required and may be supplied in any order, either with multiple
121d4af9e69SDag-Erling Smørgrav.Fl C
122d4af9e69SDag-Erling Smørgravoptions or as a comma-separated list.
1231ec0d754SDag-Erling Smørgrav.It Fl D
1241ec0d754SDag-Erling SmørgravWhen this option is specified,
1251ec0d754SDag-Erling Smørgrav.Nm
1261ec0d754SDag-Erling Smørgravwill not detach and does not become a daemon.
1271ec0d754SDag-Erling SmørgravThis allows easy monitoring of
1281ec0d754SDag-Erling Smørgrav.Nm sshd .
129511b41d2SMark Murray.It Fl d
1303c6ae118SKris KennawayDebug mode.
1313c6ae118SKris KennawayThe server sends verbose debug output to the system
1323c6ae118SKris Kennawaylog, and does not put itself in the background.
1333c6ae118SKris KennawayThe server also will not fork and will only process one connection.
1343c6ae118SKris KennawayThis option is only intended for debugging for the server.
135e73e9afaSDag-Erling SmørgravMultiple
136e73e9afaSDag-Erling Smørgrav.Fl d
137e73e9afaSDag-Erling Smørgravoptions increase the debugging level.
13809958426SBrian FeldmanMaximum is 3.
139ca3176e7SBrian Feldman.It Fl e
140ca3176e7SBrian FeldmanWhen this option is specified,
141ca3176e7SBrian Feldman.Nm
142ca3176e7SBrian Feldmanwill send the output to the standard error instead of the system log.
143d4af9e69SDag-Erling Smørgrav.It Fl f Ar config_file
1443c6ae118SKris KennawaySpecifies the name of the configuration file.
1453c6ae118SKris KennawayThe default is
1462134165cSKris Kennaway.Pa /etc/ssh/sshd_config .
147511b41d2SMark Murray.Nm
148511b41d2SMark Murrayrefuses to start if there is no configuration file.
149511b41d2SMark Murray.It Fl g Ar login_grace_time
150511b41d2SMark MurrayGives the grace time for clients to authenticate themselves (default
151f388f5efSDag-Erling Smørgrav120 seconds).
1523c6ae118SKris KennawayIf the client fails to authenticate the user within
1533c6ae118SKris Kennawaythis many seconds, the server disconnects and exits.
1543c6ae118SKris KennawayA value of zero indicates no limit.
155511b41d2SMark Murray.It Fl h Ar host_key_file
156af12a3e7SDag-Erling SmørgravSpecifies a file from which a host key is read.
157511b41d2SMark MurrayThis option must be given if
158511b41d2SMark Murray.Nm
159511b41d2SMark Murrayis not run as root (as the normal
160af12a3e7SDag-Erling Smørgravhost key files are normally not readable by anyone but root).
161af12a3e7SDag-Erling SmørgravThe default is
162af12a3e7SDag-Erling Smørgrav.Pa /etc/ssh/ssh_host_key
163af12a3e7SDag-Erling Smørgravfor protocol version 1, and
164d4af9e69SDag-Erling Smørgrav.Pa /etc/ssh/ssh_host_rsa_key
165d4af9e69SDag-Erling Smørgravand
166af12a3e7SDag-Erling Smørgrav.Pa /etc/ssh/ssh_host_dsa_key
167af12a3e7SDag-Erling Smørgravfor protocol version 2.
168ca3176e7SBrian FeldmanIt is possible to have multiple host key files for
169ca3176e7SBrian Feldmanthe different protocol versions and host key algorithms.
170511b41d2SMark Murray.It Fl i
171511b41d2SMark MurraySpecifies that
172511b41d2SMark Murray.Nm
173e73e9afaSDag-Erling Smørgravis being run from
174e73e9afaSDag-Erling Smørgrav.Xr inetd 8 .
175511b41d2SMark Murray.Nm
176511b41d2SMark Murrayis normally not run
177511b41d2SMark Murrayfrom inetd because it needs to generate the server key before it can
1783c6ae118SKris Kennawayrespond to the client, and this may take tens of seconds.
1793c6ae118SKris KennawayClients would have to wait too long if the key was regenerated every time.
180333ee039SDag-Erling SmørgravHowever, with small key sizes (e.g. 512) using
181511b41d2SMark Murray.Nm
182511b41d2SMark Murrayfrom inetd may
183511b41d2SMark Murraybe feasible.
184511b41d2SMark Murray.It Fl k Ar key_gen_time
185ca3176e7SBrian FeldmanSpecifies how often the ephemeral protocol version 1 server key is
186ca3176e7SBrian Feldmanregenerated (default 3600 seconds, or one hour).
1873c6ae118SKris KennawayThe motivation for regenerating the key fairly
1881ec0d754SDag-Erling Smørgravoften is that the key is not stored anywhere, and after about an hour
189511b41d2SMark Murrayit becomes impossible to recover the key for decrypting intercepted
190511b41d2SMark Murraycommunications even if the machine is cracked into or physically
1913c6ae118SKris Kennawayseized.
1923c6ae118SKris KennawayA value of zero indicates that the key will never be regenerated.
193af12a3e7SDag-Erling Smørgrav.It Fl o Ar option
194af12a3e7SDag-Erling SmørgravCan be used to give options in the format used in the configuration file.
195af12a3e7SDag-Erling SmørgravThis is useful for specifying options for which there is no separate
196af12a3e7SDag-Erling Smørgravcommand-line flag.
1971ec0d754SDag-Erling SmørgravFor full details of the options, and their values, see
1981ec0d754SDag-Erling Smørgrav.Xr sshd_config 5 .
199511b41d2SMark Murray.It Fl p Ar port
200511b41d2SMark MurraySpecifies the port on which the server listens for connections
201511b41d2SMark Murray(default 22).
202af12a3e7SDag-Erling SmørgravMultiple port options are permitted.
203b74df5b2SDag-Erling SmørgravPorts specified in the configuration file with the
204b74df5b2SDag-Erling Smørgrav.Cm Port
205b74df5b2SDag-Erling Smørgravoption are ignored when a command-line port is specified.
206b74df5b2SDag-Erling SmørgravPorts specified using the
207b74df5b2SDag-Erling Smørgrav.Cm ListenAddress
208b74df5b2SDag-Erling Smørgravoption override command-line ports.
209511b41d2SMark Murray.It Fl q
2103c6ae118SKris KennawayQuiet mode.
2113c6ae118SKris KennawayNothing is sent to the system log.
2123c6ae118SKris KennawayNormally the beginning,
213511b41d2SMark Murrayauthentication, and termination of each connection is logged.
214d4af9e69SDag-Erling Smørgrav.It Fl T
215d4af9e69SDag-Erling SmørgravExtended test mode.
216d4af9e69SDag-Erling SmørgravCheck the validity of the configuration file, output the effective configuration
217d4af9e69SDag-Erling Smørgravto stdout and then exit.
218d4af9e69SDag-Erling SmørgravOptionally,
219d4af9e69SDag-Erling Smørgrav.Cm Match
220d4af9e69SDag-Erling Smørgravrules may be applied by specifying the connection parameters using one or more
221d4af9e69SDag-Erling Smørgrav.Fl C
222d4af9e69SDag-Erling Smørgravoptions.
223af12a3e7SDag-Erling Smørgrav.It Fl t
224af12a3e7SDag-Erling SmørgravTest mode.
225af12a3e7SDag-Erling SmørgravOnly check the validity of the configuration file and sanity of the keys.
226af12a3e7SDag-Erling SmørgravThis is useful for updating
227af12a3e7SDag-Erling Smørgrav.Nm
228af12a3e7SDag-Erling Smørgravreliably as configuration options may change.
229c2d3a559SKris Kennaway.It Fl u Ar len
230c2d3a559SKris KennawayThis option is used to specify the size of the field
231c2d3a559SKris Kennawayin the
232c2d3a559SKris Kennaway.Li utmp
233c2d3a559SKris Kennawaystructure that holds the remote host name.
234c2d3a559SKris KennawayIf the resolved host name is longer than
235c2d3a559SKris Kennaway.Ar len ,
236c2d3a559SKris Kennawaythe dotted decimal value will be used instead.
237c2d3a559SKris KennawayThis allows hosts with very long host names that
238c2d3a559SKris Kennawayoverflow this field to still be uniquely identified.
239c2d3a559SKris KennawaySpecifying
240c2d3a559SKris Kennaway.Fl u0
241c2d3a559SKris Kennawayindicates that only dotted decimal addresses
242c2d3a559SKris Kennawayshould be put into the
243c2d3a559SKris Kennaway.Pa utmp
244c2d3a559SKris Kennawayfile.
245af12a3e7SDag-Erling Smørgrav.Fl u0
246e73e9afaSDag-Erling Smørgravmay also be used to prevent
247af12a3e7SDag-Erling Smørgrav.Nm
248af12a3e7SDag-Erling Smørgravfrom making DNS requests unless the authentication
249af12a3e7SDag-Erling Smørgravmechanism or configuration requires it.
250af12a3e7SDag-Erling SmørgravAuthentication mechanisms that may require DNS include
251af12a3e7SDag-Erling Smørgrav.Cm RhostsRSAAuthentication ,
252b74df5b2SDag-Erling Smørgrav.Cm HostbasedAuthentication ,
253af12a3e7SDag-Erling Smørgravand using a
254af12a3e7SDag-Erling Smørgrav.Cm from="pattern-list"
255af12a3e7SDag-Erling Smørgravoption in a key file.
256af12a3e7SDag-Erling SmørgravConfiguration options that require DNS include using a
257af12a3e7SDag-Erling SmørgravUSER@HOST pattern in
258af12a3e7SDag-Erling Smørgrav.Cm AllowUsers
259af12a3e7SDag-Erling Smørgravor
260af12a3e7SDag-Erling Smørgrav.Cm DenyUsers .
261511b41d2SMark Murray.El
262b74df5b2SDag-Erling Smørgrav.Sh AUTHENTICATION
263b74df5b2SDag-Erling SmørgravThe OpenSSH SSH daemon supports SSH protocols 1 and 2.
264b74df5b2SDag-Erling SmørgravBoth protocols are supported by default,
265b74df5b2SDag-Erling Smørgravthough this can be changed via the
266b74df5b2SDag-Erling Smørgrav.Cm Protocol
267b74df5b2SDag-Erling Smørgravoption in
268614c49a9SDag-Erling Smørgrav.Xr sshd_config 5 .
269b74df5b2SDag-Erling SmørgravProtocol 2 supports both RSA and DSA keys;
270b74df5b2SDag-Erling Smørgravprotocol 1 only supports RSA keys.
271b74df5b2SDag-Erling SmørgravFor both protocols,
272b74df5b2SDag-Erling Smørgraveach host has a host-specific key,
273b74df5b2SDag-Erling Smørgravnormally 2048 bits,
274b74df5b2SDag-Erling Smørgravused to identify the host.
275b74df5b2SDag-Erling Smørgrav.Pp
276b74df5b2SDag-Erling SmørgravForward security for protocol 1 is provided through
277b74df5b2SDag-Erling Smørgravan additional server key,
278b74df5b2SDag-Erling Smørgravnormally 768 bits,
279b74df5b2SDag-Erling Smørgravgenerated when the server starts.
280b74df5b2SDag-Erling SmørgravThis key is normally regenerated every hour if it has been used, and
281b74df5b2SDag-Erling Smørgravis never stored on disk.
282b74df5b2SDag-Erling SmørgravWhenever a client connects, the daemon responds with its public
283b74df5b2SDag-Erling Smørgravhost and server keys.
284b74df5b2SDag-Erling SmørgravThe client compares the
285b74df5b2SDag-Erling SmørgravRSA host key against its own database to verify that it has not changed.
286b74df5b2SDag-Erling SmørgravThe client then generates a 256-bit random number.
287b74df5b2SDag-Erling SmørgravIt encrypts this
288b74df5b2SDag-Erling Smørgravrandom number using both the host key and the server key, and sends
289b74df5b2SDag-Erling Smørgravthe encrypted number to the server.
290b74df5b2SDag-Erling SmørgravBoth sides then use this
291b74df5b2SDag-Erling Smørgravrandom number as a session key which is used to encrypt all further
292b74df5b2SDag-Erling Smørgravcommunications in the session.
293b74df5b2SDag-Erling SmørgravThe rest of the session is encrypted
294b74df5b2SDag-Erling Smørgravusing a conventional cipher, currently Blowfish or 3DES, with 3DES
295b74df5b2SDag-Erling Smørgravbeing used by default.
296b74df5b2SDag-Erling SmørgravThe client selects the encryption algorithm
297b74df5b2SDag-Erling Smørgravto use from those offered by the server.
298b74df5b2SDag-Erling Smørgrav.Pp
299b74df5b2SDag-Erling SmørgravFor protocol 2,
300b74df5b2SDag-Erling Smørgravforward security is provided through a Diffie-Hellman key agreement.
301b74df5b2SDag-Erling SmørgravThis key agreement results in a shared session key.
302b74df5b2SDag-Erling SmørgravThe rest of the session is encrypted using a symmetric cipher, currently
303b74df5b2SDag-Erling Smørgrav128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES.
304b74df5b2SDag-Erling SmørgravThe client selects the encryption algorithm
305b74df5b2SDag-Erling Smørgravto use from those offered by the server.
306b74df5b2SDag-Erling SmørgravAdditionally, session integrity is provided
307b74df5b2SDag-Erling Smørgravthrough a cryptographic message authentication code
308d4af9e69SDag-Erling Smørgrav(hmac-md5, hmac-sha1, umac-64 or hmac-ripemd160).
309b74df5b2SDag-Erling Smørgrav.Pp
310b74df5b2SDag-Erling SmørgravFinally, the server and the client enter an authentication dialog.
311b74df5b2SDag-Erling SmørgravThe client tries to authenticate itself using
312b74df5b2SDag-Erling Smørgravhost-based authentication,
313b74df5b2SDag-Erling Smørgravpublic key authentication,
314b74df5b2SDag-Erling Smørgravchallenge-response authentication,
315b74df5b2SDag-Erling Smørgravor password authentication.
316b74df5b2SDag-Erling Smørgrav.Pp
317b74df5b2SDag-Erling SmørgravRegardless of the authentication type, the account is checked to
318b74df5b2SDag-Erling Smørgravensure that it is accessible.  An account is not accessible if it is
319b74df5b2SDag-Erling Smørgravlocked, listed in
320b74df5b2SDag-Erling Smørgrav.Cm DenyUsers
321b74df5b2SDag-Erling Smørgravor its group is listed in
322b74df5b2SDag-Erling Smørgrav.Cm DenyGroups
323b74df5b2SDag-Erling Smørgrav\&.  The definition of a locked account is system dependant. Some platforms
324b74df5b2SDag-Erling Smørgravhave their own account database (eg AIX) and some modify the passwd field (
325b74df5b2SDag-Erling Smørgrav.Ql \&*LK\&*
326b74df5b2SDag-Erling Smørgravon Solaris and UnixWare,
327b74df5b2SDag-Erling Smørgrav.Ql \&*
328b74df5b2SDag-Erling Smørgravon HP-UX, containing
329b74df5b2SDag-Erling Smørgrav.Ql Nologin
330b74df5b2SDag-Erling Smørgravon Tru64,
331b74df5b2SDag-Erling Smørgrava leading
332b74df5b2SDag-Erling Smørgrav.Ql \&*LOCKED\&*
333b74df5b2SDag-Erling Smørgravon FreeBSD and a leading
334d4af9e69SDag-Erling Smørgrav.Ql \&!
335d4af9e69SDag-Erling Smørgravon most Linuxes).
336d4af9e69SDag-Erling SmørgravIf there is a requirement to disable password authentication
337b74df5b2SDag-Erling Smørgravfor the account while allowing still public-key, then the passwd field
338b74df5b2SDag-Erling Smørgravshould be set to something other than these values (eg
339b74df5b2SDag-Erling Smørgrav.Ql NP
340b74df5b2SDag-Erling Smørgravor
341b74df5b2SDag-Erling Smørgrav.Ql \&*NP\&*
342b74df5b2SDag-Erling Smørgrav).
343b74df5b2SDag-Erling Smørgrav.Pp
344b74df5b2SDag-Erling SmørgravIf the client successfully authenticates itself, a dialog for
345b74df5b2SDag-Erling Smørgravpreparing the session is entered.
346b74df5b2SDag-Erling SmørgravAt this time the client may request
347b74df5b2SDag-Erling Smørgravthings like allocating a pseudo-tty, forwarding X11 connections,
348b74df5b2SDag-Erling Smørgravforwarding TCP connections, or forwarding the authentication agent
349b74df5b2SDag-Erling Smørgravconnection over the secure channel.
350b74df5b2SDag-Erling Smørgrav.Pp
351333ee039SDag-Erling SmørgravAfter this, the client either requests a shell or execution of a command.
352b74df5b2SDag-Erling SmørgravThe sides then enter session mode.
353b74df5b2SDag-Erling SmørgravIn this mode, either side may send
354b74df5b2SDag-Erling Smørgravdata at any time, and such data is forwarded to/from the shell or
355b74df5b2SDag-Erling Smørgravcommand on the server side, and the user terminal in the client side.
356b74df5b2SDag-Erling Smørgrav.Pp
357b74df5b2SDag-Erling SmørgravWhen the user program terminates and all forwarded X11 and other
358b74df5b2SDag-Erling Smørgravconnections have been closed, the server sends command exit status to
359b74df5b2SDag-Erling Smørgravthe client, and both sides exit.
360511b41d2SMark Murray.Sh LOGIN PROCESS
361511b41d2SMark MurrayWhen a user successfully logs in,
362511b41d2SMark Murray.Nm
363511b41d2SMark Murraydoes the following:
364511b41d2SMark Murray.Bl -enum -offset indent
365511b41d2SMark Murray.It
366511b41d2SMark MurrayIf the login is on a tty, and no command has been specified,
367511b41d2SMark Murrayprints last login time and
368511b41d2SMark Murray.Pa /etc/motd
369511b41d2SMark Murray(unless prevented in the configuration file or by
370d4ecd108SDag-Erling Smørgrav.Pa ~/.hushlogin ;
371511b41d2SMark Murraysee the
372511b41d2SMark Murray.Sx FILES
373511b41d2SMark Murraysection).
374511b41d2SMark Murray.It
375511b41d2SMark MurrayIf the login is on a tty, records login time.
376511b41d2SMark Murray.It
377511b41d2SMark MurrayChecks
37835d4ccfbSDag-Erling Smørgrav.Pa /etc/nologin and
37935d4ccfbSDag-Erling Smørgrav.Pa /var/run/nologin ;
38035d4ccfbSDag-Erling Smørgravif one exists, it prints the contents and quits
381511b41d2SMark Murray(unless root).
382511b41d2SMark Murray.It
383511b41d2SMark MurrayChanges to run with normal user privileges.
384511b41d2SMark Murray.It
385511b41d2SMark MurraySets up basic environment.
386511b41d2SMark Murray.It
3871ec0d754SDag-Erling SmørgravReads the file
388d4ecd108SDag-Erling Smørgrav.Pa ~/.ssh/environment ,
3891ec0d754SDag-Erling Smørgravif it exists, and users are allowed to change their environment.
390f388f5efSDag-Erling SmørgravSee the
391f388f5efSDag-Erling Smørgrav.Cm PermitUserEnvironment
392f388f5efSDag-Erling Smørgravoption in
393f388f5efSDag-Erling Smørgrav.Xr sshd_config 5 .
394511b41d2SMark Murray.It
395511b41d2SMark MurrayChanges to user's home directory.
396511b41d2SMark Murray.It
397511b41d2SMark MurrayIf
398d4ecd108SDag-Erling Smørgrav.Pa ~/.ssh/rc
399511b41d2SMark Murrayexists, runs it; else if
4002134165cSKris Kennaway.Pa /etc/ssh/sshrc
401511b41d2SMark Murrayexists, runs
40235d4ccfbSDag-Erling Smørgravit; otherwise runs
40335d4ccfbSDag-Erling Smørgrav.Xr xauth 1 .
4046a8633dbSKris KennawayThe
405511b41d2SMark Murray.Dq rc
406511b41d2SMark Murrayfiles are given the X11
407333ee039SDag-Erling Smørgravauthentication protocol and cookie in standard input.
408333ee039SDag-Erling SmørgravSee
409333ee039SDag-Erling Smørgrav.Sx SSHRC ,
410333ee039SDag-Erling Smørgravbelow.
411511b41d2SMark Murray.It
412511b41d2SMark MurrayRuns user's shell or command.
413511b41d2SMark Murray.El
414333ee039SDag-Erling Smørgrav.Sh SSHRC
415333ee039SDag-Erling SmørgravIf the file
416333ee039SDag-Erling Smørgrav.Pa ~/.ssh/rc
417333ee039SDag-Erling Smørgravexists,
418333ee039SDag-Erling Smørgrav.Xr sh 1
419333ee039SDag-Erling Smørgravruns it after reading the
420333ee039SDag-Erling Smørgravenvironment files but before starting the user's shell or command.
421333ee039SDag-Erling SmørgravIt must not produce any output on stdout; stderr must be used
422333ee039SDag-Erling Smørgravinstead.
423333ee039SDag-Erling SmørgravIf X11 forwarding is in use, it will receive the "proto cookie" pair in
424333ee039SDag-Erling Smørgravits standard input (and
425333ee039SDag-Erling Smørgrav.Ev DISPLAY
426333ee039SDag-Erling Smørgravin its environment).
427333ee039SDag-Erling SmørgravThe script must call
428333ee039SDag-Erling Smørgrav.Xr xauth 1
429333ee039SDag-Erling Smørgravbecause
430333ee039SDag-Erling Smørgrav.Nm
431333ee039SDag-Erling Smørgravwill not run xauth automatically to add X11 cookies.
432ca3176e7SBrian Feldman.Pp
433333ee039SDag-Erling SmørgravThe primary purpose of this file is to run any initialization routines
434333ee039SDag-Erling Smørgravwhich may be needed before the user's home directory becomes
435333ee039SDag-Erling Smørgravaccessible; AFS is a particular example of such an environment.
436333ee039SDag-Erling Smørgrav.Pp
437333ee039SDag-Erling SmørgravThis file will probably contain some initialization code followed by
438333ee039SDag-Erling Smørgravsomething similar to:
439333ee039SDag-Erling Smørgrav.Bd -literal -offset 3n
440333ee039SDag-Erling Smørgravif read proto cookie && [ -n "$DISPLAY" ]; then
441333ee039SDag-Erling Smørgrav	if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
442333ee039SDag-Erling Smørgrav		# X11UseLocalhost=yes
443333ee039SDag-Erling Smørgrav		echo add unix:`echo $DISPLAY |
444333ee039SDag-Erling Smørgrav		    cut -c11-` $proto $cookie
445333ee039SDag-Erling Smørgrav	else
446333ee039SDag-Erling Smørgrav		# X11UseLocalhost=no
447333ee039SDag-Erling Smørgrav		echo add $DISPLAY $proto $cookie
448333ee039SDag-Erling Smørgrav	fi | xauth -q -
449333ee039SDag-Erling Smørgravfi
450333ee039SDag-Erling Smørgrav.Ed
451333ee039SDag-Erling Smørgrav.Pp
452333ee039SDag-Erling SmørgravIf this file does not exist,
453333ee039SDag-Erling Smørgrav.Pa /etc/ssh/sshrc
454333ee039SDag-Erling Smørgravis run, and if that
455333ee039SDag-Erling Smørgravdoes not exist either, xauth is used to add the cookie.
456333ee039SDag-Erling Smørgrav.Sh AUTHORIZED_KEYS FILE FORMAT
457333ee039SDag-Erling Smørgrav.Cm AuthorizedKeysFile
458333ee039SDag-Erling Smørgravspecifies the file containing public keys for
459333ee039SDag-Erling Smørgravpublic key authentication;
460333ee039SDag-Erling Smørgravif none is specified, the default is
461333ee039SDag-Erling Smørgrav.Pa ~/.ssh/authorized_keys .
4623c6ae118SKris KennawayEach line of the file contains one
463511b41d2SMark Murraykey (empty lines and lines starting with a
464511b41d2SMark Murray.Ql #
465511b41d2SMark Murrayare ignored as
4663c6ae118SKris Kennawaycomments).
467333ee039SDag-Erling SmørgravProtocol 1 public keys consist of the following space-separated fields:
468333ee039SDag-Erling Smørgravoptions, bits, exponent, modulus, comment.
469333ee039SDag-Erling SmørgravProtocol 2 public key consist of:
470333ee039SDag-Erling Smørgravoptions, keytype, base64-encoded key, comment.
471333ee039SDag-Erling SmørgravThe options field is optional;
472333ee039SDag-Erling Smørgravits presence is determined by whether the line starts
473f388f5efSDag-Erling Smørgravwith a number or not (the options field never starts with a number).
474333ee039SDag-Erling SmørgravThe bits, exponent, modulus, and comment fields give the RSA key for
475ca3176e7SBrian Feldmanprotocol version 1; the
476511b41d2SMark Murraycomment field is not used for anything (but may be convenient for the
477511b41d2SMark Murrayuser to identify the key).
478ca3176e7SBrian FeldmanFor protocol version 2 the keytype is
479ca3176e7SBrian Feldman.Dq ssh-dss
480ca3176e7SBrian Feldmanor
481ca3176e7SBrian Feldman.Dq ssh-rsa .
482511b41d2SMark Murray.Pp
483511b41d2SMark MurrayNote that lines in this file are usually several hundred bytes long
484aa49c926SDag-Erling Smørgrav(because of the size of the public key encoding) up to a limit of
485aa49c926SDag-Erling Smørgrav8 kilobytes, which permits DSA keys up to 8 kilobits and RSA
486aa49c926SDag-Erling Smørgravkeys up to 16 kilobits.
4873c6ae118SKris KennawayYou don't want to type them in; instead, copy the
488ca3176e7SBrian Feldman.Pa identity.pub ,
489333ee039SDag-Erling Smørgrav.Pa id_dsa.pub ,
490ca3176e7SBrian Feldmanor the
491ca3176e7SBrian Feldman.Pa id_rsa.pub
492511b41d2SMark Murrayfile and edit it.
493511b41d2SMark Murray.Pp
494614c49a9SDag-Erling Smørgrav.Nm
495614c49a9SDag-Erling Smørgravenforces a minimum RSA key modulus size for protocol 1
496614c49a9SDag-Erling Smørgravand protocol 2 keys of 768 bits.
497614c49a9SDag-Erling Smørgrav.Pp
498c2d3a559SKris KennawayThe options (if present) consist of comma-separated option
4993c6ae118SKris Kennawayspecifications.
5003c6ae118SKris KennawayNo spaces are permitted, except within double quotes.
501af12a3e7SDag-Erling SmørgravThe following option specifications are supported (note
502af12a3e7SDag-Erling Smørgravthat option keywords are case-insensitive):
503511b41d2SMark Murray.Bl -tag -width Ds
504511b41d2SMark Murray.It Cm command="command"
505511b41d2SMark MurraySpecifies that the command is executed whenever this key is used for
5063c6ae118SKris Kennawayauthentication.
5073c6ae118SKris KennawayThe command supplied by the user (if any) is ignored.
508af12a3e7SDag-Erling SmørgravThe command is run on a pty if the client requests a pty;
5093c6ae118SKris Kennawayotherwise it is run without a tty.
510e73e9afaSDag-Erling SmørgravIf an 8-bit clean channel is required,
511af12a3e7SDag-Erling Smørgravone must not request a pty or should specify
512ca3176e7SBrian Feldman.Cm no-pty .
5133c6ae118SKris KennawayA quote may be included in the command by quoting it with a backslash.
5143c6ae118SKris KennawayThis option might be useful
515f388f5efSDag-Erling Smørgravto restrict certain public keys to perform just a specific operation.
5163c6ae118SKris KennawayAn example might be a key that permits remote backups but nothing else.
517b74df5b2SDag-Erling SmørgravNote that the client may specify TCP and/or X11
518e8aafc91SKris Kennawayforwarding unless they are explicitly prohibited.
519333ee039SDag-Erling SmørgravThe command originally supplied by the client is available in the
520333ee039SDag-Erling Smørgrav.Ev SSH_ORIGINAL_COMMAND
521333ee039SDag-Erling Smørgravenvironment variable.
522af12a3e7SDag-Erling SmørgravNote that this option applies to shell, command or subsystem execution.
523511b41d2SMark Murray.It Cm environment="NAME=value"
524511b41d2SMark MurraySpecifies that the string is to be added to the environment when
5253c6ae118SKris Kennawaylogging in using this key.
5263c6ae118SKris KennawayEnvironment variables set this way
5273c6ae118SKris Kennawayoverride other default environment values.
5283c6ae118SKris KennawayMultiple options of this type are permitted.
529f388f5efSDag-Erling SmørgravEnvironment processing is disabled by default and is
530f388f5efSDag-Erling Smørgravcontrolled via the
531f388f5efSDag-Erling Smørgrav.Cm PermitUserEnvironment
532f388f5efSDag-Erling Smørgravoption.
533af12a3e7SDag-Erling SmørgravThis option is automatically disabled if
534af12a3e7SDag-Erling Smørgrav.Cm UseLogin
535af12a3e7SDag-Erling Smørgravis enabled.
536333ee039SDag-Erling Smørgrav.It Cm from="pattern-list"
537d4af9e69SDag-Erling SmørgravSpecifies that in addition to public key authentication, either the canonical
538d4af9e69SDag-Erling Smørgravname of the remote host or its IP address must be present in the
539d4af9e69SDag-Erling Smørgravcomma-separated list of patterns.
540333ee039SDag-Erling SmørgravSee
541333ee039SDag-Erling Smørgrav.Sx PATTERNS
542333ee039SDag-Erling Smørgravin
543333ee039SDag-Erling Smørgrav.Xr ssh_config 5
544333ee039SDag-Erling Smørgravfor more information on patterns.
545d4af9e69SDag-Erling Smørgrav.Pp
546d4af9e69SDag-Erling SmørgravIn addition to the wildcard matching that may be applied to hostnames or
547d4af9e69SDag-Erling Smørgravaddresses, a
548d4af9e69SDag-Erling Smørgrav.Cm from
5497aee6ffeSDag-Erling Smørgravstanza may match IP addresses using CIDR address/masklen notation.
550d4af9e69SDag-Erling Smørgrav.Pp
551d4af9e69SDag-Erling SmørgravThe purpose of this option is to optionally increase security: public key
552d4af9e69SDag-Erling Smørgravauthentication by itself does not trust the network or name servers or
553d4af9e69SDag-Erling Smørgravanything (but the key); however, if somebody somehow steals the key, the key
554d4af9e69SDag-Erling Smørgravpermits an intruder to log in from anywhere in the world.
555d4af9e69SDag-Erling SmørgravThis additional option makes using a stolen key more difficult (name
556d4af9e69SDag-Erling Smørgravservers and/or routers would have to be compromised in addition to
557d4af9e69SDag-Erling Smørgravjust the key).
558511b41d2SMark Murray.It Cm no-agent-forwarding
559511b41d2SMark MurrayForbids authentication agent forwarding when this key is used for
560511b41d2SMark Murrayauthentication.
561333ee039SDag-Erling Smørgrav.It Cm no-port-forwarding
562333ee039SDag-Erling SmørgravForbids TCP forwarding when this key is used for authentication.
563333ee039SDag-Erling SmørgravAny port forward requests by the client will return an error.
564333ee039SDag-Erling SmørgravThis might be used, e.g. in connection with the
565333ee039SDag-Erling Smørgrav.Cm command
566333ee039SDag-Erling Smørgravoption.
567511b41d2SMark Murray.It Cm no-pty
568511b41d2SMark MurrayPrevents tty allocation (a request to allocate a pty will fail).
569d4af9e69SDag-Erling Smørgrav.It Cm no-user-rc
570d4af9e69SDag-Erling SmørgravDisables execution of
571d4af9e69SDag-Erling Smørgrav.Pa ~/.ssh/rc .
572333ee039SDag-Erling Smørgrav.It Cm no-X11-forwarding
573333ee039SDag-Erling SmørgravForbids X11 forwarding when this key is used for authentication.
574333ee039SDag-Erling SmørgravAny X11 forward requests by the client will return an error.
575ca3176e7SBrian Feldman.It Cm permitopen="host:port"
576ca3176e7SBrian FeldmanLimit local
577ca3176e7SBrian Feldman.Li ``ssh -L''
578ca3176e7SBrian Feldmanport forwarding such that it may only connect to the specified host and
579af12a3e7SDag-Erling Smørgravport.
580af12a3e7SDag-Erling SmørgravIPv6 addresses can be specified with an alternative syntax:
5811ec0d754SDag-Erling Smørgrav.Ar host Ns / Ns Ar port .
582af12a3e7SDag-Erling SmørgravMultiple
583ca3176e7SBrian Feldman.Cm permitopen
584cf2b5f3bSDag-Erling Smørgravoptions may be applied separated by commas.
585cf2b5f3bSDag-Erling SmørgravNo pattern matching is performed on the specified hostnames,
586cf2b5f3bSDag-Erling Smørgravthey must be literal domains or addresses.
587b74df5b2SDag-Erling Smørgrav.It Cm tunnel="n"
588b74df5b2SDag-Erling SmørgravForce a
589b74df5b2SDag-Erling Smørgrav.Xr tun 4
590b74df5b2SDag-Erling Smørgravdevice on the server.
591b74df5b2SDag-Erling SmørgravWithout this option, the next available device will be used if
592b74df5b2SDag-Erling Smørgravthe client requests a tunnel.
593511b41d2SMark Murray.El
594ca3176e7SBrian Feldman.Pp
595333ee039SDag-Erling SmørgravAn example authorized_keys file:
596333ee039SDag-Erling Smørgrav.Bd -literal -offset 3n
597333ee039SDag-Erling Smørgrav# Comments allowed at start of line
598333ee039SDag-Erling Smørgravssh-rsa AAAAB3Nza...LiPk== user@example.net
599333ee039SDag-Erling Smørgravfrom="*.sales.example.net,!pc.sales.example.net" ssh-rsa
600333ee039SDag-Erling SmørgravAAAAB2...19Q== john@example.net
601333ee039SDag-Erling Smørgravcommand="dump /home",no-pty,no-port-forwarding ssh-dss
602333ee039SDag-Erling SmørgravAAAAC3...51R== example.net
603333ee039SDag-Erling Smørgravpermitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss
604333ee039SDag-Erling SmørgravAAAAB5...21S==
605333ee039SDag-Erling Smørgravtunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...==
606333ee039SDag-Erling Smørgravjane@example.net
607333ee039SDag-Erling Smørgrav.Ed
608511b41d2SMark Murray.Sh SSH_KNOWN_HOSTS FILE FORMAT
609511b41d2SMark MurrayThe
61035d4ccfbSDag-Erling Smørgrav.Pa /etc/ssh/ssh_known_hosts
611511b41d2SMark Murrayand
612d4ecd108SDag-Erling Smørgrav.Pa ~/.ssh/known_hosts
6133c6ae118SKris Kennawayfiles contain host public keys for all known hosts.
6143c6ae118SKris KennawayThe global file should
6155c51cd64SMike Pritchardbe prepared by the administrator (optional), and the per-user file is
616333ee039SDag-Erling Smørgravmaintained automatically: whenever the user connects from an unknown host,
617511b41d2SMark Murrayits key is added to the per-user file.
618511b41d2SMark Murray.Pp
619511b41d2SMark MurrayEach line in these files contains the following fields: hostnames,
6203c6ae118SKris Kennawaybits, exponent, modulus, comment.
6213c6ae118SKris KennawayThe fields are separated by spaces.
622511b41d2SMark Murray.Pp
623cf2b5f3bSDag-Erling SmørgravHostnames is a comma-separated list of patterns
624333ee039SDag-Erling Smørgrav.Pf ( Ql *
625cf2b5f3bSDag-Erling Smørgravand
626cf2b5f3bSDag-Erling Smørgrav.Ql \&?
627cf2b5f3bSDag-Erling Smørgravact as
628511b41d2SMark Murraywildcards); each pattern in turn is matched against the canonical host
629511b41d2SMark Murrayname (when authenticating a client) or against the user-supplied
6303c6ae118SKris Kennawayname (when authenticating a server).
6313c6ae118SKris KennawayA pattern may also be preceded by
632cf2b5f3bSDag-Erling Smørgrav.Ql \&!
633511b41d2SMark Murrayto indicate negation: if the host name matches a negated
634511b41d2SMark Murraypattern, it is not accepted (by that line) even if it matched another
635511b41d2SMark Murraypattern on the line.
636333ee039SDag-Erling SmørgravA hostname or address may optionally be enclosed within
637333ee039SDag-Erling Smørgrav.Ql \&[
638333ee039SDag-Erling Smørgravand
639333ee039SDag-Erling Smørgrav.Ql \&]
640333ee039SDag-Erling Smørgravbrackets then followed by
641333ee039SDag-Erling Smørgrav.Ql \&:
642333ee039SDag-Erling Smørgravand a non-standard port number.
643511b41d2SMark Murray.Pp
644aa49c926SDag-Erling SmørgravAlternately, hostnames may be stored in a hashed form which hides host names
645aa49c926SDag-Erling Smørgravand addresses should the file's contents be disclosed.
646aa49c926SDag-Erling SmørgravHashed hostnames start with a
647aa49c926SDag-Erling Smørgrav.Ql |
648aa49c926SDag-Erling Smørgravcharacter.
649aa49c926SDag-Erling SmørgravOnly one hashed hostname may appear on a single line and none of the above
650aa49c926SDag-Erling Smørgravnegation or wildcard operators may be applied.
651aa49c926SDag-Erling Smørgrav.Pp
652e8aafc91SKris KennawayBits, exponent, and modulus are taken directly from the RSA host key; they
653333ee039SDag-Erling Smørgravcan be obtained, for example, from
6542134165cSKris Kennaway.Pa /etc/ssh/ssh_host_key.pub .
655511b41d2SMark MurrayThe optional comment field continues to the end of the line, and is not used.
656511b41d2SMark Murray.Pp
657511b41d2SMark MurrayLines starting with
658511b41d2SMark Murray.Ql #
659511b41d2SMark Murrayand empty lines are ignored as comments.
660511b41d2SMark Murray.Pp
661511b41d2SMark MurrayWhen performing host authentication, authentication is accepted if any
6623c6ae118SKris Kennawaymatching line has the proper key.
6633c6ae118SKris KennawayIt is thus permissible (but not
664511b41d2SMark Murrayrecommended) to have several lines or different host keys for the same
6653c6ae118SKris Kennawaynames.
6663c6ae118SKris KennawayThis will inevitably happen when short forms of host names
6673c6ae118SKris Kennawayfrom different domains are put in the file.
6683c6ae118SKris KennawayIt is possible
669511b41d2SMark Murraythat the files contain conflicting information; authentication is
670511b41d2SMark Murrayaccepted if valid information can be found from either file.
671511b41d2SMark Murray.Pp
672511b41d2SMark MurrayNote that the lines in these files are typically hundreds of characters
673511b41d2SMark Murraylong, and you definitely don't want to type in the host keys by hand.
674511b41d2SMark MurrayRather, generate them by a script
675511b41d2SMark Murrayor by taking
6762134165cSKris Kennaway.Pa /etc/ssh/ssh_host_key.pub
677511b41d2SMark Murrayand adding the host names at the front.
678333ee039SDag-Erling Smørgrav.Pp
679333ee039SDag-Erling SmørgravAn example ssh_known_hosts file:
680333ee039SDag-Erling Smørgrav.Bd -literal -offset 3n
681333ee039SDag-Erling Smørgrav# Comments allowed at start of line
682333ee039SDag-Erling Smørgravclosenet,...,192.0.2.53 1024 37 159...93 closenet.example.net
683333ee039SDag-Erling Smørgravcvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....=
684aa49c926SDag-Erling Smørgrav# A hashed hostname
685aa49c926SDag-Erling Smørgrav|1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa
686aa49c926SDag-Erling SmørgravAAAA1234.....=
687aa49c926SDag-Erling Smørgrav.Ed
688511b41d2SMark Murray.Sh FILES
689333ee039SDag-Erling Smørgrav.Bl -tag -width Ds -compact
690333ee039SDag-Erling Smørgrav.It ~/.hushlogin
691aa49c926SDag-Erling SmørgravThis file is used to suppress printing the last login time and
692aa49c926SDag-Erling Smørgrav.Pa /etc/motd ,
693aa49c926SDag-Erling Smørgravif
694aa49c926SDag-Erling Smørgrav.Cm PrintLastLog
695aa49c926SDag-Erling Smørgravand
696aa49c926SDag-Erling Smørgrav.Cm PrintMotd ,
697aa49c926SDag-Erling Smørgravrespectively,
698aa49c926SDag-Erling Smørgravare enabled.
699aa49c926SDag-Erling SmørgravIt does not suppress printing of the banner specified by
700aa49c926SDag-Erling Smørgrav.Cm Banner .
701333ee039SDag-Erling Smørgrav.Pp
702333ee039SDag-Erling Smørgrav.It ~/.rhosts
703333ee039SDag-Erling SmørgravThis file is used for host-based authentication (see
704333ee039SDag-Erling Smørgrav.Xr ssh 1
705333ee039SDag-Erling Smørgravfor more information).
706333ee039SDag-Erling SmørgravOn some machines this file may need to be
707333ee039SDag-Erling Smørgravworld-readable if the user's home directory is on an NFS partition,
708333ee039SDag-Erling Smørgravbecause
709511b41d2SMark Murray.Nm
710333ee039SDag-Erling Smørgravreads it as root.
711333ee039SDag-Erling SmørgravAdditionally, this file must be owned by the user,
712333ee039SDag-Erling Smørgravand must not have write permissions for anyone else.
713333ee039SDag-Erling SmørgravThe recommended
714333ee039SDag-Erling Smørgravpermission for most machines is read/write for the user, and not
715511b41d2SMark Murrayaccessible by others.
716511b41d2SMark Murray.Pp
717333ee039SDag-Erling Smørgrav.It ~/.shosts
718333ee039SDag-Erling SmørgravThis file is used in exactly the same way as
719333ee039SDag-Erling Smørgrav.Pa .rhosts ,
720333ee039SDag-Erling Smørgravbut allows host-based authentication without permitting login with
721333ee039SDag-Erling Smørgravrlogin/rsh.
722511b41d2SMark Murray.Pp
723d4af9e69SDag-Erling Smørgrav.It ~/.ssh/
724d4af9e69SDag-Erling SmørgravThis directory is the default location for all user-specific configuration
725d4af9e69SDag-Erling Smørgravand authentication information.
726d4af9e69SDag-Erling SmørgravThere is no general requirement to keep the entire contents of this directory
727d4af9e69SDag-Erling Smørgravsecret, but the recommended permissions are read/write/execute for the user,
728d4af9e69SDag-Erling Smørgravand not accessible by others.
729d4af9e69SDag-Erling Smørgrav.Pp
730333ee039SDag-Erling Smørgrav.It ~/.ssh/authorized_keys
731333ee039SDag-Erling SmørgravLists the public keys (RSA/DSA) that can be used for logging in as this user.
732333ee039SDag-Erling SmørgravThe format of this file is described above.
733333ee039SDag-Erling SmørgravThe content of the file is not highly sensitive, but the recommended
734333ee039SDag-Erling Smørgravpermissions are read/write for the user, and not accessible by others.
735511b41d2SMark Murray.Pp
736333ee039SDag-Erling SmørgravIf this file, the
737333ee039SDag-Erling Smørgrav.Pa ~/.ssh
738333ee039SDag-Erling Smørgravdirectory, or the user's home directory are writable
739333ee039SDag-Erling Smørgravby other users, then the file could be modified or replaced by unauthorized
740333ee039SDag-Erling Smørgravusers.
741333ee039SDag-Erling SmørgravIn this case,
742333ee039SDag-Erling Smørgrav.Nm
743333ee039SDag-Erling Smørgravwill not allow it to be used unless the
744333ee039SDag-Erling Smørgrav.Cm StrictModes
745333ee039SDag-Erling Smørgravoption has been set to
746333ee039SDag-Erling Smørgrav.Dq no .
747511b41d2SMark Murray.Pp
748333ee039SDag-Erling Smørgrav.It ~/.ssh/environment
7493c6ae118SKris KennawayThis file is read into the environment at login (if it exists).
7503c6ae118SKris KennawayIt can only contain empty lines, comment lines (that start with
751511b41d2SMark Murray.Ql # ) ,
7523c6ae118SKris Kennawayand assignment lines of the form name=value.
7533c6ae118SKris KennawayThe file should be writable
754511b41d2SMark Murrayonly by the user; it need not be readable by anyone else.
755f388f5efSDag-Erling SmørgravEnvironment processing is disabled by default and is
756f388f5efSDag-Erling Smørgravcontrolled via the
757f388f5efSDag-Erling Smørgrav.Cm PermitUserEnvironment
758f388f5efSDag-Erling Smørgravoption.
759511b41d2SMark Murray.Pp
760333ee039SDag-Erling Smørgrav.It ~/.ssh/known_hosts
761333ee039SDag-Erling SmørgravContains a list of host keys for all hosts the user has logged into
762333ee039SDag-Erling Smørgravthat are not already in the systemwide list of known host keys.
763333ee039SDag-Erling SmørgravThe format of this file is described above.
764333ee039SDag-Erling SmørgravThis file should be writable only by root/the owner and
765333ee039SDag-Erling Smørgravcan, but need not be, world-readable.
766511b41d2SMark Murray.Pp
767333ee039SDag-Erling Smørgrav.It ~/.ssh/rc
768333ee039SDag-Erling SmørgravContains initialization routines to be run before
769333ee039SDag-Erling Smørgravthe user's home directory becomes accessible.
770511b41d2SMark MurrayThis file should be writable only by the user, and need not be
771511b41d2SMark Murrayreadable by anyone else.
772333ee039SDag-Erling Smørgrav.Pp
773333ee039SDag-Erling Smørgrav.It /etc/hosts.allow
774333ee039SDag-Erling Smørgrav.It /etc/hosts.deny
775333ee039SDag-Erling SmørgravAccess controls that should be enforced by tcp-wrappers are defined here.
776333ee039SDag-Erling SmørgravFurther details are described in
777333ee039SDag-Erling Smørgrav.Xr hosts_access 5 .
778333ee039SDag-Erling Smørgrav.Pp
779333ee039SDag-Erling Smørgrav.It /etc/hosts.equiv
780333ee039SDag-Erling SmørgravThis file is for host-based authentication (see
781333ee039SDag-Erling Smørgrav.Xr ssh 1 ) .
782333ee039SDag-Erling SmørgravIt should only be writable by root.
783333ee039SDag-Erling Smørgrav.Pp
784333ee039SDag-Erling Smørgrav.It /etc/moduli
785333ee039SDag-Erling SmørgravContains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".
786333ee039SDag-Erling SmørgravThe file format is described in
787333ee039SDag-Erling Smørgrav.Xr moduli 5 .
788333ee039SDag-Erling Smørgrav.Pp
789333ee039SDag-Erling Smørgrav.It /etc/motd
790333ee039SDag-Erling SmørgravSee
791333ee039SDag-Erling Smørgrav.Xr motd 5 .
792333ee039SDag-Erling Smørgrav.Pp
793333ee039SDag-Erling Smørgrav.It /etc/nologin
794333ee039SDag-Erling SmørgravIf this file exists,
795333ee039SDag-Erling Smørgrav.Nm
796333ee039SDag-Erling Smørgravrefuses to let anyone except root log in.
797333ee039SDag-Erling SmørgravThe contents of the file
798333ee039SDag-Erling Smørgravare displayed to anyone trying to log in, and non-root connections are
799333ee039SDag-Erling Smørgravrefused.
800333ee039SDag-Erling SmørgravThe file should be world-readable.
801333ee039SDag-Erling Smørgrav.Pp
802333ee039SDag-Erling Smørgrav.It /etc/shosts.equiv
803333ee039SDag-Erling SmørgravThis file is used in exactly the same way as
804333ee039SDag-Erling Smørgrav.Pa hosts.equiv ,
805333ee039SDag-Erling Smørgravbut allows host-based authentication without permitting login with
806333ee039SDag-Erling Smørgravrlogin/rsh.
807333ee039SDag-Erling Smørgrav.Pp
808333ee039SDag-Erling Smørgrav.It /etc/ssh/ssh_host_key
809333ee039SDag-Erling Smørgrav.It /etc/ssh/ssh_host_dsa_key
810333ee039SDag-Erling Smørgrav.It /etc/ssh/ssh_host_rsa_key
811333ee039SDag-Erling SmørgravThese three files contain the private parts of the host keys.
812333ee039SDag-Erling SmørgravThese files should only be owned by root, readable only by root, and not
813333ee039SDag-Erling Smørgravaccessible to others.
814333ee039SDag-Erling SmørgravNote that
815333ee039SDag-Erling Smørgrav.Nm
816333ee039SDag-Erling Smørgravdoes not start if these files are group/world-accessible.
817333ee039SDag-Erling Smørgrav.Pp
818333ee039SDag-Erling Smørgrav.It /etc/ssh/ssh_host_key.pub
819333ee039SDag-Erling Smørgrav.It /etc/ssh/ssh_host_dsa_key.pub
820333ee039SDag-Erling Smørgrav.It /etc/ssh/ssh_host_rsa_key.pub
821333ee039SDag-Erling SmørgravThese three files contain the public parts of the host keys.
822333ee039SDag-Erling SmørgravThese files should be world-readable but writable only by
823333ee039SDag-Erling Smørgravroot.
824333ee039SDag-Erling SmørgravTheir contents should match the respective private parts.
825333ee039SDag-Erling SmørgravThese files are not
826333ee039SDag-Erling Smørgravreally used for anything; they are provided for the convenience of
827333ee039SDag-Erling Smørgravthe user so their contents can be copied to known hosts files.
828333ee039SDag-Erling SmørgravThese files are created using
829333ee039SDag-Erling Smørgrav.Xr ssh-keygen 1 .
830333ee039SDag-Erling Smørgrav.Pp
831d4af9e69SDag-Erling Smørgrav.It /etc/ssh/ssh_known_hosts
832d4af9e69SDag-Erling SmørgravSystemwide list of known host keys.
833d4af9e69SDag-Erling SmørgravThis file should be prepared by the
834d4af9e69SDag-Erling Smørgravsystem administrator to contain the public host keys of all machines in the
835d4af9e69SDag-Erling Smørgravorganization.
836d4af9e69SDag-Erling SmørgravThe format of this file is described above.
837d4af9e69SDag-Erling SmørgravThis file should be writable only by root/the owner and
838d4af9e69SDag-Erling Smørgravshould be world-readable.
839d4af9e69SDag-Erling Smørgrav.Pp
840333ee039SDag-Erling Smørgrav.It /etc/ssh/sshd_config
841333ee039SDag-Erling SmørgravContains configuration data for
842333ee039SDag-Erling Smørgrav.Nm sshd .
843333ee039SDag-Erling SmørgravThe file format and configuration options are described in
844333ee039SDag-Erling Smørgrav.Xr sshd_config 5 .
845333ee039SDag-Erling Smørgrav.Pp
846333ee039SDag-Erling Smørgrav.It /etc/ssh/sshrc
847333ee039SDag-Erling SmørgravSimilar to
848333ee039SDag-Erling Smørgrav.Pa ~/.ssh/rc ,
849333ee039SDag-Erling Smørgravit can be used to specify
8503c6ae118SKris Kennawaymachine-specific login-time initializations globally.
8513c6ae118SKris KennawayThis file should be writable only by root, and should be world-readable.
852333ee039SDag-Erling Smørgrav.Pp
853333ee039SDag-Erling Smørgrav.It /var/empty
854333ee039SDag-Erling Smørgrav.Xr chroot 2
855333ee039SDag-Erling Smørgravdirectory used by
856333ee039SDag-Erling Smørgrav.Nm
857333ee039SDag-Erling Smørgravduring privilege separation in the pre-authentication phase.
858333ee039SDag-Erling SmørgravThe directory should not contain any files and must be owned by root
859333ee039SDag-Erling Smørgravand not group or world-writable.
860333ee039SDag-Erling Smørgrav.Pp
861333ee039SDag-Erling Smørgrav.It /var/run/sshd.pid
862333ee039SDag-Erling SmørgravContains the process ID of the
863333ee039SDag-Erling Smørgrav.Nm
864333ee039SDag-Erling Smørgravlistening for connections (if there are several daemons running
865333ee039SDag-Erling Smørgravconcurrently for different ports, this contains the process ID of the one
866333ee039SDag-Erling Smørgravstarted last).
867333ee039SDag-Erling SmørgravThe content of this file is not sensitive; it can be world-readable.
868c2d3a559SKris Kennaway.El
869511b41d2SMark Murray.Sh SEE ALSO
870511b41d2SMark Murray.Xr scp 1 ,
871ca3176e7SBrian Feldman.Xr sftp 1 ,
872511b41d2SMark Murray.Xr ssh 1 ,
873511b41d2SMark Murray.Xr ssh-add 1 ,
874511b41d2SMark Murray.Xr ssh-agent 1 ,
875511b41d2SMark Murray.Xr ssh-keygen 1 ,
876d4af9e69SDag-Erling Smørgrav.Xr ssh-keyscan 1 ,
8771ec0d754SDag-Erling Smørgrav.Xr chroot 2 ,
8781ec0d754SDag-Erling Smørgrav.Xr hosts_access 5 ,
879af12a3e7SDag-Erling Smørgrav.Xr login.conf 5 ,
880af12a3e7SDag-Erling Smørgrav.Xr moduli 5 ,
881614c49a9SDag-Erling Smørgrav.Xr sshd_config 5 ,
8821ec0d754SDag-Erling Smørgrav.Xr inetd 8 ,
883af12a3e7SDag-Erling Smørgrav.Xr sftp-server 8
884cf2b5f3bSDag-Erling Smørgrav.Sh AUTHORS
885cf2b5f3bSDag-Erling SmørgravOpenSSH is a derivative of the original and free
886cf2b5f3bSDag-Erling Smørgravssh 1.2.12 release by Tatu Ylonen.
887cf2b5f3bSDag-Erling SmørgravAaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
888cf2b5f3bSDag-Erling SmørgravTheo de Raadt and Dug Song
889cf2b5f3bSDag-Erling Smørgravremoved many bugs, re-added newer features and
890cf2b5f3bSDag-Erling Smørgravcreated OpenSSH.
891cf2b5f3bSDag-Erling SmørgravMarkus Friedl contributed the support for SSH
892cf2b5f3bSDag-Erling Smørgravprotocol versions 1.5 and 2.0.
893cf2b5f3bSDag-Erling SmørgravNiels Provos and Markus Friedl contributed support
894cf2b5f3bSDag-Erling Smørgravfor privilege separation.
895333ee039SDag-Erling Smørgrav.Sh CAVEATS
896333ee039SDag-Erling SmørgravSystem security is not improved unless
897333ee039SDag-Erling Smørgrav.Nm rshd ,
898333ee039SDag-Erling Smørgrav.Nm rlogind ,
899333ee039SDag-Erling Smørgravand
900333ee039SDag-Erling Smørgrav.Nm rexecd
901333ee039SDag-Erling Smørgravare disabled (thus completely disabling
902333ee039SDag-Erling Smørgrav.Xr rlogin
903333ee039SDag-Erling Smørgravand
904333ee039SDag-Erling Smørgrav.Xr rsh
905333ee039SDag-Erling Smørgravinto the machine).
906