rexec, rexec_r - Allow command execution on a remote host
#include <netdb.h> #include <unistd.h>
int *err_file_desc );
The following function is supported in order to maintain
backward compatibility with previous versions of the operating
system: int rexec_r(
struct hostent_data *host_data );
Standard C Library (libc)
Contains the name of a remote host that is listed in the
/etc/hosts file or /etc/resolv.conffile. If the name of
the host is not found in either file, the rexec() fails.
Specifies the well-known Internet port to use for the connection.
A pointer to the structure that contains the
necessary port can be obtained by issuing the following
getservbyname("exec", "tcp") Points to a user ID
that is valid on the host. Points to the password
of the specified user ID on the host. Points to
the name of the command to be executed at the
remote host. Specifies the file to which standard
error from the remote command is sent.
If the err_file_desc parameter is 0 (zero), the
standard error of the remote command is the same as
standard output. No provision is made for sending
arbitrary signals to the remote process. In this
case, however, it may be possible to send out-ofband
data to the remote command.
If the err_file_desc parameter is nonzero, an auxiliary
channel to a control process is set up, and
a descriptor for it is placed in the err_file_desc
parameter. The control process provides diagnostic
output from the remote command on this channel and
also accepts bytes as signal numbers to be forwarded
to the process group of the command. This
diagnostic information does not include remote
authorization failure, since this connection is set
up after authorization has been verified. Perthread
data for reentrant version.
The rexec() (remote execution) function allows the calling
process to execute commands on a remote host.
If the rexec() connection succeeds, a socket in the Internet
domain of type SOCK_STREAM is returned to the calling
process and is given to the remote command as standard
input and standard output.
The user and passwd parameters specify a valid user ID and
the associated password for that user on the remote host.
If the user and passwd parameters are not supplied, the
rexec() function takes the following actions until finding
a user ID and password to send to the remote host: It
searches the current environment for the user ID and password
on the remote host. It searches the user's home
directory for a file called $HOME/.netrc that contains a
user ID and password. It prompts the user for a user ID
Note that action 3 does not apply when using rexec_r().
The rexec_r() function is the reentrant version of
rexec(). It is supported in order to maintain backward
compatibility with previous versions of the operating system.
The netdb.h header file defines the hostent_data
Upon successful completion, the system returns a socket
descriptor to the remote command. Otherwise, a value of -1
is returned, indicating that the specified hostname does
Contains hostnames and their addresses for hosts in a network.
This file is used to resolve a hostname into an
Internet address. Contains the name server and domain
name. Contains automatic login information.
Functions: getservbyname(3), rcmd(3), rresvport(3),
[ Back ]