1REXEC(3) Linux Programmer's Manual REXEC(3)
2
3
4
6 rexec, rexec_af - return stream to a remote command
7
9 #include <netdb.h>
10
11 int rexec(char **ahost, int inport, const char *user,
12 const char *passwd, const char *cmd, int *fd2p);
13
14 int rexec_af(char **ahost, int inport, const char *user,
15 const char *passwd, const char *cmd, int *fd2p,
16 sa_family_t af);
17
18 rexec(), rexec_af():
19 Since glibc 2.19:
20 _DEFAULT_SOURCE
21 In glibc up to and including 2.19:
22 _BSD_SOURCE
23
25 This interface is obsoleted by rcmd(3).
26
27 The rexec() function looks up the host *ahost using gethostbyname(3),
28 returning -1 if the host does not exist. Otherwise, *ahost is set to
29 the standard name of the host. If a username and password are both
30 specified, then these are used to authenticate to the foreign host;
31 otherwise the environment and then the .netrc file in user's home
32 directory are searched for appropriate information. If all this fails,
33 the user is prompted for the information.
34
35 The port inport specifies which well-known DARPA Internet port to use
36 for the connection; the call getservbyname("exec", "tcp") (see getser‐
37 vent(3)) will return a pointer to a structure that contains the neces‐
38 sary port. The protocol for connection is described in detail in rex‐
39 ecd(8).
40
41 If the connection succeeds, a socket in the Internet domain of type
42 SOCK_STREAM is returned to the caller, and given to the remote command
43 as stdin and stdout. If fd2p is nonzero, then an auxiliary channel to
44 a control process will be setup, and a file descriptor for it will be
45 placed in *fd2p. The control process will return diagnostic output
46 from the command (unit 2) on this channel, and will also accept bytes
47 on this channel as being UNIX signal numbers, to be forwarded to the
48 process group of the command. The diagnostic information returned does
49 not include remote authorization failure, as the secondary connection
50 is set up after authorization has been verified. If fd2p is 0, then
51 the stderr (unit 2 of the remote command) will be made the same as the
52 stdout and no provision is made for sending arbitrary signals to the
53 remote process, although you may be able to get its attention by using
54 out-of-band data.
55
56 rexec_af()
57 The rexec() function works over IPv4 (AF_INET). By contrast, the
58 rexec_af() function provides an extra argument, af, that allows the
59 caller to select the protocol. This argument can be specified as
60 AF_INET, AF_INET6, or AF_UNSPEC (to allow the implementation to select
61 the protocol).
62
64 The rexec_af() function was added to glibc in version 2.2.
65
67 For an explanation of the terms used in this section, see
68 attributes(7).
69
70 ┌────────────────────┬───────────────┬───────────┐
71 │Interface │ Attribute │ Value │
72 ├────────────────────┼───────────────┼───────────┤
73 │rexec(), rexec_af() │ Thread safety │ MT-Unsafe │
74 └────────────────────┴───────────────┴───────────┘
76 These functions are not in POSIX.1. The rexec() function first
77 appeared in 4.2BSD, and is present on the BSDs, Solaris, and many other
78 systems. The rexec_af() function is more recent, and less widespread.
79
81 The rexec() function sends the unencrypted password across the network.
82
83 The underlying service is considered a big security hole and therefore
84 not enabled on many sites; see rexecd(8) for explanations.
85
87 rcmd(3), rexecd(8)
88
90 This page is part of release 5.04 of the Linux man-pages project. A
91 description of the project, information about reporting bugs, and the
92 latest version of this page, can be found at
93 https://www.kernel.org/doc/man-pages/.
94
95
96
97Linux 2017-09-15 REXEC(3)