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
	  host	    Contains 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.

	  port	    Specifies the well-known DARPA Internet port to
		    use	for the	connection.  A pointer to the struc-
		    ture that contains the necessary port can be
		    obtained by	issuing	the following library call:
		    getservbyname()("exec","tcp")

	  user	    Points to a	user ID	valid at the host.

	  passwd    Points to the password of the specified user ID on
		    the	host.

	  command   Points to the name of the command to be executed
		    at the remote host.

	  err_file_desc
		    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-of-band	data to	the remote command.

		    If the err_file_desc parameter is nonzero, an aux-
		    iliary 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 diagnos-
		    tic	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 connec-
		    tion is set	up after authorization has been	veri-
		    fied.


     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	pro-
	  cess 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.


	  Note that action 3 does not apply when using the threadsafe
	  version of rexec() function.

     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/hosts
		    Contains 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)















































Acknowledgement and Disclaimer