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