xref: /netbsd/libexec/rshd/rshd.8 (revision c4a72b64)
1.\"	$NetBSD: rshd.8,v 1.13 2002/09/29 14:05:55 wiz Exp $
2.\"
3.\" Copyright (c) 1983, 1989, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     from: @(#)rshd.8	8.1 (Berkeley) 6/4/93
35.\"
36.Dd January 22, 2000
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 alnL
45.Sh DESCRIPTION
46The
47.Nm
48server is the server for the
49.Xr rcmd 3
50routine and, consequently, for the
51.Xr rsh 1
52program.
53The server provides remote execution facilities
54with authentication based on privileged port numbers from trusted hosts.
55.Pp
56The
57.Nm
58server listens for service requests at the port indicated in
59the ``cmd'' service specification; see
60.Xr services 5 .
61When a service request is received the following protocol
62is initiated:
63.Bl -enum
64.It
65The server checks the client's source port.
66If the port is not in the range 512-1023, the server
67aborts the connection.
68.It
69The server reads characters from the socket up
70to a null (`\e0') byte.
71The resultant string is interpreted as an
72.Tn ASCII
73number, base 10.
74.It
75If the number received in step 2 is non-zero,
76it is interpreted as the port number of a secondary
77stream to be used for the
78.Em stderr .
79A second connection is then created to the specified
80port on the client's machine.
81The source port of this
82second connection is also in the range 512-1023.
83.It
84The server checks the client's source address
85and requests the corresponding host name (see
86.Xr gethostbyaddr 3 ,
87.Xr hosts 5
88and
89.Xr named 8 ) .
90If the hostname cannot be determined,
91the dot-notation representation of the host address is used.
92If the hostname is in the same domain as the server (according to
93the last two components of the domain name), or if the
94.Fl a
95option is given,
96the addresses for the hostname are requested,
97verifying that the name and address correspond.
98If address verification fails, the connection is aborted
99with the message, ``Host address mismatch.''
100.It
101A null terminated user name of at most 16 characters
102is retrieved on the initial socket.
103This user name is interpreted as the user identity on the
104.Em client Ns 's
105machine.
106.It
107A null terminated user name of at most 16 characters
108is retrieved on the initial socket.
109This user name is interpreted as a user identity to use on the
110.Sy server Ns 's
111machine.
112.It
113A null terminated command to be passed to a
114shell is retrieved on the initial socket.
115The length of the command is limited by the upper
116bound on the size of the system's argument list.
117.It
118.Nm
119then validates the user using
120.Xr ruserok 3 ,
121which uses the file
122.Pa /etc/hosts.equiv
123and the
124.Pa .rhosts
125file found in the user's home directory.
126The
127.Fl l
128option prevents
129.Xr ruserok 3
130from doing any validation based on the user's ``.rhosts'' file,
131unless the user is the superuser.
132.It
133If the file
134.Pa /etc/nologin
135exists and the user is not the superuser,
136the connection is closed.
137.It
138A null byte is returned on the initial socket
139and the command line is passed to the normal login
140shell of the user.
141The shell inherits the network connections established by
142.Nm "" .
143.El
144.Pp
145Transport-level keepalive messages are enabled unless the
146.Fl n
147option is present.
148The use of keepalive messages allows sessions to be timed out
149if the client crashes or becomes unreachable.
150.Pp
151The
152.Fl L
153option causes all successful accesses to be logged to
154.Xr syslogd 8
155as
156.Li auth.info
157messages.
158.Sh DIAGNOSTICS
159Except for the last one listed below,
160all diagnostic messages
161are returned on the initial socket,
162after which any network connections are closed.
163An error is indicated by a leading byte with a value of
1641 (0 is returned in step 10 above upon successful completion
165of all the steps prior to the execution of the login shell).
166.Bl -tag -width indent
167.It Sy Locuser too long.
168The name of the user on the client's machine is
169longer than 16 characters.
170.It Sy Ruser too long.
171The name of the user on the remote machine is
172longer than 16 characters.
173.It Sy Command too long  .
174The command line passed exceeds the size of the argument
175list (as configured into the system).
176.It Sy Login incorrect.
177No password file entry for the user name existed.
178.It Sy Remote directory.
179The
180.Xr chdir 2
181to the home directory failed.
182.It Sy Permission denied.
183The authentication procedure described above failed.
184.It Sy Can't make pipe.
185The pipe needed for the
186.Em stderr ,
187wasn't created.
188.It Sy Can't fork; try again.
189A
190.Xr fork 2
191by the server failed.
192.It Sy \*[Lt]shellname\*[Gt]: ...
193The user's login shell could not be started.
194This message is returned on the connection associated with the
195.Em stderr ,
196and is not preceded by a flag byte.
197.El
198.Sh SEE ALSO
199.Xr rsh 1 ,
200.Xr rcmd 3 ,
201.Xr ruserok 3 ,
202.Xr login.conf 5
203.Sh BUGS
204The authentication procedure used here assumes the integrity
205of each client machine and the connecting medium.
206This is insecure, but is useful in an ``open'' environment.
207.Pp
208A facility to allow all data exchanges to be encrypted should be
209present.
210.Pp
211A more extensible protocol (such as Telnet) should be used.
212.Pp
213.Nm
214intentionally rejects accesses from IPv4 mapped address on top of
215.Dv AF_INET6
216socket, since IPv4 mapped address complicates
217host-address based authentication.
218If you would like to accept connections from IPv4 peers, you will need to run
219.Nm
220on top of
221.Dv AF_INET
222socket, not
223.Dv AF_INET6
224socket.
225