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