1RSHD(8)                   BSD System Manager's Manual                  RSHD(8)
2

NAME

4     rshd — remote shell server
5

SYNOPSIS

7     rshd [-ahlnL]
8

DESCRIPTION

10     The rshd server is the server for the rcmd(3) routine and, consequently,
11     for the rsh(1) program.  The server provides remote execution facilities
12     with authentication based on privileged port numbers from trusted hosts.
13
14     The rshd server listens for service requests at the port indicated in the
15     ``cmd'' service specification; see services(5).  When a service request
16     is received the following protocol is initiated:
17
18     1.   The server checks the client's source port.  If the port is not in
19          the range 512-1023, the server aborts the connection.
20
21     2.   The server reads characters from the socket up to a null (`\0')
22          byte.  The resultant string is interpreted as an ASCII number, base
23          10.
24
25     3.   If the number received in step 2 is non-zero, it is interpreted as
26          the port number of a secondary stream to be used for the stderr.  A
27          second connection is then created to the specified port on the
28          client's machine.  The source port of this second connection is also
29          in the range 512-1023.
30
31     4.   The server checks the client's source address and requests the cor‐
32          responding host name (see gethostbyaddr(3), hosts(5) and named(8)).
33          If the hostname cannot be determined, the dot-notation representa‐
34          tion of the host address is used.  If the hostname is in the same
35          domain as the server (according to the last two components of the
36          domain name), or if the -a option is given, the addresses for the
37          hostname are requested, verifying that the name and address corre‐
38          spond.  If address verification fails, the connection is aborted
39          with the message, ``Host address mismatch.''
40
41     5.   A null terminated user name of at most 16 characters is retrieved on
42          the initial socket.  This user name is interpreted as the user iden‐
43          tity on the client's machine.
44
45     6.   A null terminated user name of at most 16 characters is retrieved on
46          the initial socket.  This user name is interpreted as a user iden‐
47          tity to use on the server's machine.
48
49     7.   A null terminated command to be passed to a shell is retrieved on
50          the initial socket.  The length of the command is limited by the
51          upper bound on the size of the system's argument list.
52
53     8.   Rshd then validates the user using ruserok(3), which uses the file
54          /etc/hosts.equiv and the .rhosts file found in the user's home
55          directory. The -l option prevents ruserok(3) from doing any valida‐
56          tion based on the user's ``.rhosts'' file (unless the user is the
57          superuser and the -h option is used.) If the -h option is not used,
58          superuser accounts may not be accessed via this service at all.
59
60          The -l option should not be trusted without verifying that it works
61          as expected with the particular version of libc installed on your
62          system (and should be tested again after any libc update) because
63          some versions of libc may not honor the flags used by rshd.
64
65          Also note that the design of the .rhosts system is COMPLETELY INSE‐
66          CURE except on a carefully firewalled private network. Under all
67          other circumstances, rshd should be disabled entirely.
68
69     9.   A null byte is returned on the initial socket and the command line
70          is passed to the normal login shell of the user.  The shell inherits
71          the network connections established by rshd.
72
73     Transport-level keepalive messages are enabled unless the -n option is
74     present.  The use of keepalive messages allows sessions to be timed out
75     if the client crashes or becomes unreachable.
76
77     The -L option causes all successful accesses to be logged to syslogd(8)
78     as auth.info messages and all failed accesses to be logged as
79     auth.notice.
80

DIAGNOSTICS

82     Except for the last one listed below, all diagnostic messages are
83     returned on the initial socket, after which any network connections are
84     closed.  An error is indicated by a leading byte with a value of 1 (0 is
85     returned in step 9 above upon successful completion of all the steps
86     prior to the execution of the login shell).
87
88     Locuser too long.
89             The name of the user on the client's machine is longer than 16
90             characters.
91
92     Ruser too long.
93             The name of the user on the remote machine is longer than 16
94             characters.
95
96     Command too long.
97             The command line passed exceeds the size of the argument list (as
98             configured into the system).
99
100     Remote directory.
101             The chdir command to the home directory failed.
102
103     Permission denied.
104             The authentication procedure described above failed, or the user
105             requested did not exist. (These conditions are intentionally con‐
106             flated.)
107
108     Can't make pipe.
109             The pipe needed for the stderr, wasn't created.
110
111     Can't fork; try again.
112             A fork by the server failed.
113
114     <shellname>: ...
115             The user's login shell could not be started.  This message is
116             returned on the connection associated with the stderr, and is not
117             preceded by a flag byte.
118

SEE ALSO

120     rsh(1), rcmd(3), ruserok(3)
121

BUGS

123     The authentication procedure used here assumes the integrity of each
124     client machine and the connecting medium.  This is insecure, but is use‐
125     ful in an ``open'' environment.
126
127     A facility to allow all data exchanges to be encrypted should be present.
128
129     A more extensible protocol (such as Telnet) should be used.
130
131Linux NetKit (0.17)             April 20, 1991             Linux NetKit (0.17)
Impressum