1REXEC(3) Linux Programmer's Manual REXEC(3)
2
3
4
6 rexec - return stream to a remote command
7
9 int rexec(char **ahost, int inport, char *user,
10 char *passwd, char *cmd, int *fd2p);
11
13 This interface is obsoleted by rcmd(3).
14
15 The rexec() function looks up the host *ahost using gethostbyname(3),
16 returning -1 if the host does not exist. Otherwise *ahost is set to
17 the standard name of the host. If a username and password are both
18 specified, then these are used to authenticate to the foreign host;
19 otherwise the environment and then the user's .netrc file in his home
20 directory are searched for appropriate information. If all this fails,
21 the user is prompted for the information.
22
23 The port inport specifies which well-known DARPA Internet port to use
24 for the connection; the call getservbyname("exec", "tcp") (see getser‐
25 vent(3)) will return a pointer to a structure that contains the neces‐
26 sary port. The protocol for connection is described in detail in rex‐
27 ecd(8).
28
29 If the connection succeeds, a socket in the Internet domain of type
30 SOCK_STREAM is returned to the caller, and given to the remote command
31 as stdin and stdout. If fd2p is nonzero, then an auxiliary channel to
32 a control process will be setup, and a descriptor for it will be placed
33 in *fd2p. The control process will return diagnostic output from the
34 command (unit 2) on this channel, and will also accept bytes on this
35 channel as being Unix signal numbers, to be forwarded to the process
36 group of the command. The diagnostic information returned does not
37 include remote authorization failure, as the secondary connection is
38 set up after authorization has been verified. If fd2p is 0, then the
39 stderr (unit 2 of the remote command) will be made the same as the std‐
40 out and no provision is made for sending arbitrary signals to the
41 remote process, although you may be able to get its attention by using
42 out-of-band data.
43
45 Not in POSIX.1-2001. Present on the BSDs, Solaris, and many other sys‐
46 tems. The rexec() function appeared in 4.2BSD.
47
49 The rexec() function sends the unencrypted password across the network.
50
51 The underlying service is considered a big security hole and therefore
52 not enabled on many sites, see rexecd(8) for explanations.
53
55 rcmd(3), rexecd(8)
56
58 This page is part of release 3.25 of the Linux man-pages project. A
59 description of the project, and information about reporting bugs, can
60 be found at http://www.kernel.org/doc/man-pages/.
61
62
63
64Linux 2007-12-28 REXEC(3)