1REXEC(3)                 BSD Library Functions Manual                 REXEC(3)
2

NAME

4     rexec — return stream to a remote command
5

LIBRARY

7     Compatibility Library (libcompat, -lcompat)
8

SYNOPSIS

10     int
11     rexec(char **ahost, int inport, char *user, char *passwd, char *cmd,
12         int *fd2p);
13

DESCRIPTION

15     This interface is obsoleted by rcmd(3).
16
17     The rexec() function looks up the host *ahost using gethostbyname(3),
18     returning -1 if the host does not exist.  Otherwise *ahost is set to the
19     standard name of the host.  If a username and password are both speci‐
20     fied, then these are used to authenticate to the foreign host; otherwise
21     the environment and then the user's .netrc file in his home directory are
22     searched for appropriate information.  If all this fails, the user is
23     prompted for the information.
24
25     The port inport specifies which well-known DARPA Internet port to use for
26     the connection; the call getservbyname("exec", "tcp") (see getservent(3))
27     will return a pointer to a structure, which contains the necessary port.
28     The protocol for connection is described in detail in rexecd(8).
29
30     If the connection succeeds, a socket in the Internet domain of type
31     SOCK_STREAM is returned to the caller, and given to the remote command as
32     stdin and stdout.  If fd2p is non-zero, then an auxiliary channel to a
33     control process will be setup, and a descriptor for it will be placed in
34     *fd2p.  The control process will return diagnostic output from the com‐
35     mand (unit 2) on this channel, and will also accept bytes on this channel
36     as being UNIX signal numbers, to be forwarded to the process group of the
37     command.  The diagnostic information returned does not include remote
38     authorization failure, as the secondary connection is set up after autho‐
39     rization has been verified.  If fd2p is 0, then the stderr (unit 2 of the
40     remote command) will be made the same as the stdout and no provision is
41     made for sending arbitrary signals to the remote process, although you
42     may be able to get its attention by using out-of-band data.
43

SEE ALSO

45     rcmd(3), rexecd(8)
46

CONFORMING TO

48     Not in POSIX.1-2001.  Present on the BSDs, Solaris, and many other sys‐
49     tems.  The rexec() function appeared in 4.2BSD.
50

BUGS

52     The rexec() function sends the unencrypted password across the network.
53
54     The underlying service is considered a big security hole and therefore
55     not enabled on many sites, see rexecd(8) for explanations.
56
57BSD                              June 4, 1993                              BSD
Impressum