Merge from vendor branch OPENSSH:
[dragonfly.git] / libexec / rshd / rshd.8
1 .\" Copyright (c) 1983, 1989, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)rshd.8      8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD: src/libexec/rshd/rshd.8,v 1.18.2.5 2001/08/16 10:44:18 ru Exp $
34 .\" $DragonFly: src/libexec/rshd/rshd.8,v 1.3 2003/11/22 19:30:55 asmodai Exp $
35 .\"
36 .Dd June 4, 1993
37 .Dt RSHD 8
38 .Os
39 .Sh NAME
40 .Nm rshd
41 .Nd remote shell server
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl \&?DLaln
45 .Sh DESCRIPTION
46 The
47 .Nm
48 server
49 is the server for the
50 .Xr rcmd 3
51 routine and, consequently, for the
52 .Xr rsh 1
53 program.  The server provides remote execution facilities
54 with authentication based on privileged port numbers from trusted hosts.
55 .Pp
56 The
57 .Nm
58 server
59 listens for service requests at the port indicated in
60 the
61 .Dq cmd
62 service specification; see
63 .Xr services 5 .
64 When a service request is received the following protocol
65 is initiated:
66 .Bl -enum
67 .It
68 The server checks the client's source port.
69 If the port is not in the range 512-1023, the server
70 aborts the connection.
71 .It
72 The server reads characters from the socket up
73 to a
74 .Tn NUL
75 (`\e0') byte.  The resultant string is
76 interpreted as an
77 .Tn ASCII
78 number, base 10.
79 .It
80 If the number received in step 2 is non-zero,
81 it is interpreted as the port number of a secondary
82 stream to be used for the
83 .Em stderr .
84 A second connection is then created to the specified
85 port on the client's machine.  The source port of this
86 second connection is also in the range 512-1023.
87 .It
88 The server checks the client's source address
89 and requests the corresponding host name (see
90 .Xr gethostbyaddr 3 ,
91 .Xr hosts 5
92 and
93 .Xr named 8 ) .
94 If the hostname cannot be determined or the hostname and address do
95 not match after verification,
96 the dot-notation representation of the host address is used.
97 .It
98 A null terminated user name of at most 16 characters
99 is retrieved on the initial socket.  This user name
100 is interpreted as the user identity on the
101 .Em client Ns 's
102 machine.
103 .It
104 A null terminated user name of at most 16 characters
105 is retrieved on the initial socket.  This user name
106 is interpreted as a user identity to use on the
107 .Em server Ns 's
108 machine.
109 .It
110 A null terminated command to be passed to a
111 shell is retrieved on the initial socket.  The length of
112 the command is limited by the upper bound on the size of
113 the system's argument list.
114 .It
115 .Nm Rshd
116 then validates the user using
117 .Xr ruserok 3 ,
118 which uses the file
119 .Pa /etc/hosts.equiv
120 and the
121 .Pa .rhosts
122 file found in the user's home directory.  The
123 .Fl l
124 option prevents
125 .Xr ruserok 3
126 from doing any validation based on the user's
127 .Pa .rhosts
128 file,
129 unless the user is the superuser.
130 .It
131 If the file
132 .Pa /var/run/nologin
133 exists and the user is not the superuser,
134 the connection is closed.
135 The name of the nologin file may be overridden
136 using the nologin capability in
137 .Pa /etc/login.conf
138 according to the local user's login class,
139 which may also be used to restrict
140 .Xr rsh 1
141 access by
142 login time (times.allow and times.deny capabilities)
143 and remote host (hosts.allow and hosts.deny capabilities).
144 .It
145 A
146 .Tn NUL
147 byte is returned on the initial socket
148 and the command line is passed to the normal login
149 shell of the user.  The
150 shell inherits the network connections established
151 by
152 .Nm .
153 .El
154 .Pp
155 The options are as follows:
156 .Bl -tag -width indent
157 .It Fl \&?
158 Display the usage message, and exit.
159 .It Fl D
160 Sets the TCP_NODELAY socket option, which improves the performance
161 of small back-to-back writes at the expense of additional network
162 traffic.
163 .It Fl L
164 Causes all successful accesses to be logged to
165 .Xr syslogd 8
166 as
167 .Li auth.info
168 messages.
169 .It Fl a
170 This flag is ignored, and is present for compatibility purposes.
171 .It Fl l
172 Do not use the user's
173 .Pa .rhosts
174 file for authentication, unless the user is the superuser.
175 .It Fl n
176 Turn off transport level keepalive messages.  This will prevent sessions
177 from timing out if the client crashes or becomes unreachable.
178 .El
179 .Sh DIAGNOSTICS
180 Except for the last one listed below,
181 all diagnostic messages
182 are returned on the initial socket,
183 after which any network connections are closed.
184 An error is indicated by a leading byte with a value of
185 1 (0 is returned in step 10 above upon successful completion
186 of all the steps prior to the execution of the login shell).
187 .Bl -tag -width indent
188 .It Sy Locuser too long.
189 The name of the user on the client's machine is
190 longer than 16 characters.
191 .It Sy Ruser too long.
192 The name of the user on the remote machine is
193 longer than 16 characters.
194 .It Sy Command too long.
195 The command line passed exceeds the size of the argument
196 list (as configured into the system).
197 .It Sy Login incorrect.
198 No password file entry for the user name existed
199 or the authentication procedure described above failed.
200 .It Sy Remote directory.
201 The
202 .Xr chdir 2
203 function to the home directory failed.
204 .It Sy Logins not available right now.
205 .Xr Rsh 1
206 was attempted outside the allowed hours defined in
207 .Pa /etc/login.conf
208 for the local user's login class.
209 .It Sy Can't make pipe.
210 The pipe needed for the
211 .Em stderr ,
212 wasn't created.
213 .It Sy Can't fork; try again.
214 A
215 .Xr fork 2
216 by the server failed.
217 .It Sy <shellname>: ...
218 The user's login shell could not be started.  This message is returned
219 on the connection associated with the
220 .Em stderr ,
221 and is not preceded by a flag byte.
222 .El
223 .Sh SEE ALSO
224 .Xr rlogin 1 ,
225 .Xr rsh 1 ,
226 .Xr gethostbyaddr 3 ,
227 .Xr rcmd 3 ,
228 .Xr ruserok 3 ,
229 .Xr auth.conf 5 ,
230 .Xr hosts 5 ,
231 .Xr hosts.equiv 5 ,
232 .Xr login.conf 5 ,
233 .Xr nologin 5 ,
234 .Xr services 5 ,
235 .Xr named 8 ,
236 .Xr rlogind 8 ,
237 .Xr syslogd 8
238 .Sh FILES
239 .Bl -tag -width /var/run/nologin -compact
240 .It Pa /etc/hosts
241 .It Pa /etc/hosts.equiv
242 .It Pa /etc/login.conf
243 .It Ev $HOME Ns Pa /.rhosts
244 .It Pa /var/run/nologin
245 .El
246 .Sh BUGS
247 The authentication procedure used here assumes the integrity
248 of each client machine and the connecting medium.  This is
249 insecure, but is useful in an
250 .Dq open
251 environment.
252 .Pp
253 A facility to allow all data exchanges to be encrypted should be
254 present.
255 .Pp
256 A more extensible protocol (such as Telnet) should be used.
257 .Sh HISTORY
258 IPv6 support was added by WIDE/KAME project.