rexec(3) — Subroutines
OSF
NAME
rexec − Allows command execution on a remote host
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
int rexec (
char ∗∗host,
int port,
char ∗user,
char ∗passwd,
char ∗command,
int ∗err_file_desc );
PARAMETERS
hostContains the name of a remote host that is listed in the /etc/hosts file or /etc/resolv.conf file. If the name of the host is not found in either file, the rexec() fails.
portSpecifies the well-known DARPA Internet port to use for the connection. A pointer to the structure that contains the necessary port can be obtained by issuing the following library call: getservbyname()(“exec”,“tcp”)
userPoints to a user ID valid at the host.
passwdPoints to the password of the specified user ID on the host.
commandPoints to the name of the command to be executed at the remote host.
err_file_descSpecifies 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-of-band 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.
DESCRIPTION
The rexec() (remote execution) function allows the calling process to execute commands on a remote host.
If the rexec() connection succeeds, a socket in theInternet 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:
1.Searches the current environment for the user ID and password on the remote host.
2.Searches the user’s home directory for a file called $HOME/.netrc that contains a user ID and password.
3.Prompts the user for a user ID and password.
RETURN VALUES
Upon successful completion, the system returns a socket to the remote command. Otherwise, -1 is returned, indicating that the specified hostname does not exist.
FILES
/etc/hostsContains hostnames and their addresses for hosts in a network. This file is used to resolve a hostname into an Internet address.
/etc/resolv.conf
Contains the name server and domain name.
$HOME/.netrc
Contains automatic login information.
RELATED INFORMATION
Functions: getservbyname(3), rcmd(3), rresvport(3), ruserok(3)
Commands: rexecd(8)