1REXEC(3)                   Linux Programmer's Manual                  REXEC(3)
2
3
4

NAME

6       rexec, rexec_af - return stream to a remote command
7

SYNOPSIS

9       #define _BSD_SOURCE             /* See feature_test_macros(7) */
10       #include <netdb.h>
11
12       int rexec(char **ahost, int inport, char *user,
13                 char *passwd, char *cmd, int *fd2p);
14
15       int rexec_af(char **ahost, int inport, char *user,
16                    char *passwd, char *cmd, int *fd2p,
17                    sa_family_t af);
18

DESCRIPTION

20       This interface is obsoleted by rcmd(3).
21
22       The  rexec()  function looks up the host *ahost using gethostbyname(3),
23       returning -1 if the host does not exist.  Otherwise *ahost  is  set  to
24       the  standard  name  of  the host.  If a username and password are both
25       specified, then these are used to authenticate  to  the  foreign  host;
26       otherwise  the  environment and then the user's .netrc file in his home
27       directory are searched for appropriate information.  If all this fails,
28       the user is prompted for the information.
29
30       The  port  inport specifies which well-known DARPA Internet port to use
31       for the connection; the call getservbyname("exec", "tcp") (see  getser‐
32       vent(3))  will return a pointer to a structure that contains the neces‐
33       sary port.  The protocol for connection is described in detail in  rex‐
34       ecd(8).
35
36       If  the  connection  succeeds,  a socket in the Internet domain of type
37       SOCK_STREAM is returned to the caller, and given to the remote  command
38       as  stdin and stdout.  If fd2p is nonzero, then an auxiliary channel to
39       a control process will be setup, and a descriptor for it will be placed
40       in  *fd2p.   The control process will return diagnostic output from the
41       command (unit 2) on this channel, and will also accept  bytes  on  this
42       channel  as  being  UNIX signal numbers, to be forwarded to the process
43       group of the command.  The diagnostic  information  returned  does  not
44       include  remote  authorization  failure, as the secondary connection is
45       set up after authorization has been verified.  If fd2p is 0,  then  the
46       stderr (unit 2 of the remote command) will be made the same as the std‐
47       out and no provision is made  for  sending  arbitrary  signals  to  the
48       remote  process, although you may be able to get its attention by using
49       out-of-band data.
50
51   rexec_af()
52       The rexec() function works  over  IPv4  (AF_INET).   By  contrast,  the
53       rexec_af()  function  provides  an  extra argument, af, that allows the
54       caller to select the protocol.   This  argument  can  be  specified  as
55       AF_INET,  AF_INET6, or AF_UNSPEC (to allow the implementation to select
56       the protocol).
57

VERSIONS

59       The rexec_af() function was added to glibc in version 2.2.
60

ATTRIBUTES

62   Multithreading (see pthreads(7))
63       The rexec() and rexec_af() functions are not thread-safe.
64

CONFORMING TO

66       These functions are not in POSIX.1-2001.  The  rexec()  function  first
67       appeared in 4.2BSD, and is present on the BSDs, Solaris, and many other
68       systems.  The rexec_af() function is more recent, and less widespread.
69

BUGS

71       The rexec() function sends the unencrypted password across the network.
72
73       The underlying service is considered a big security hole and  therefore
74       not enabled on many sites; see rexecd(8) for explanations.
75

SEE ALSO

77       rcmd(3), rexecd(8)
78

COLOPHON

80       This  page  is  part of release 3.53 of the Linux man-pages project.  A
81       description of the project, and information about reporting  bugs,  can
82       be found at http://www.kernel.org/doc/man-pages/.
83
84
85
86Linux                             2013-07-04                          REXEC(3)
Impressum