rexec(3N)rexec(3N)NAMErexec(), rexec_af() - return stream to a remote command
SYNOPSISDESCRIPTION
The routine performs the necessary tasks to arrange for the remote exe‐
cution of cmd on the remote host as user, who is authenticated with
passwd. Upon completion of authentication, a file descriptor is
returned for the socket to which standard input and standard output of
cmd are attached. A command-level interface to is provided by the com‐
mand (see remsh(1)).
When invoked, looks up host using (see gethostent(3N)) and returns −1
if the host does not exist. The host name can be either the official
name or an alias. If the call succeeds, is set to the standard name of
the host. Next, passes a user name and password to the remote host for
authentication, as specified in the user and passwd parameters to If
either user or passwd are NULL, searches for the appropriate informa‐
tion in the file (see netrc(4)) in the user's home directory. If no
user or passwd are found, prompts the user for the remote user name and
password, defaulting to the local user name and a NULL password.
The inport variable specifies which TCP port to use for the connection;
it is normally the value returned by the following call to
(see getservent(3N)). The protocol used by is described in detail in
rexecd(1M).
If the call succeeds, a socket of type is returned to the caller, and
given to the remote command as and If connection to a socket is denied
after five tries, or for some other reason (other than the port is in
use), returns −1. If fd2p is non-zero, an auxiliary connection to a
control process is set up and a file descriptor for it is placed in The
control process returns diagnostic output from the command on this con‐
nection and accepts bytes on this connection, interpreting them as UNIX
signal numbers to be forwarded to the process group of the command. If
the auxiliary port cannot be set up, returns −1. If fd2p is 0, of the
remote command is made the same as and no provision is made for sending
arbitrary signals to the remote process.
The routine is similar to the routine except for the additional parame‐
ter af. The af parameter in the routine can be used to specify an
socket or an socket. If the address family specified in the af argu‐
ment is not supported, fails with the following error code:
DIAGNOTISCS
When invoked, produces the following diagnostic messages:
The remote host name was not found by
Error in executing the system call. The message specifies the
cause of the failure.
Error in connecting to the socket obtained for The message spec‐
ifies the cause of the failure.
Error in creating a secondary socket for error transmission to
be used by
Error in reading information transmitted over the socket. The
message specifies the cause of the failure.
The remote host did not connect within 30 seconds to the sec‐
ondary socket set up as an error connection.
The program attempts to read from the socket and fails. This
means the socket connection with the remote host was lost.
Error in opening file in the home directory for a reason other
than the file not existing.
The file is readable, writable or executable by someone other
than the owner.
Check whether has been modified by someone else and change the
mode of
An unrecognized keyword has been found in (see netrc(4)).
Correct the keyword in
While waiting for the secondary socket to be set up, had its
primary connection shut down. This may have been caused by an
security failure (see inetd(1M)).
While trying to set up the secondary socket, had an error condi‐
tion on its primary connection.
While trying to set up a secondary socket, ran out of a
resource, which caused the accept to time out.
Repeat the command. If a timeout occurs, check whether the
Internet Services are installed and is running.
EXAMPLES
To execute the command on remote host using the remote account is
invoked as follows:
WARNINGS
There is no way to specify options to the call that makes.
A program using should not be put in the background when is expected to
prompt for a password or user name. Putting in the background will
cause it to compete with the current shell process for input.
Since replaces the pointer to the host name with a pointer to the stan‐
dard name of the host in a static data area, this value must be copied
into the user's data area if it is to be used later.
The password is sent unencrypted through the socket connection.
AUTHOR
was developed by the University of California, Berkeley.
SEE ALSOremsh(1), inetd(1M), rexecd(1M), gethostent(3N), getservent(3N),
rcmd(3N), netrc(4).
rexec(3N)