'\" t .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" SPDX-License-Identifier: BSD-4-Clause-UC .\" .\" @(#)rexec.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD: src/lib/libcompat/4.3/rexec.3,v 1.12 2004/07/02 23:52:14 ru Exp $ .\" .\" Taken from FreeBSD 5.4; not checked against Linux reality (mtk) .\" .\" 2013-06-21, mtk, Converted from mdoc to man macros .\" .TH rexec 3 2024-05-02 "Linux man-pages 6.8" .SH NAME rexec, rexec_af \- return stream to a remote command .SH LIBRARY Standard C library .RI ( libc ", " \-lc ) .SH SYNOPSIS .nf .B #include .P .B [[deprecated]] .BI "int rexec(char **restrict " ahost ", int " inport , .BI " const char *restrict " user ", const char *restrict " passwd , .BI " const char *restrict " cmd ", int *restrict " fd2p ); .P .B [[deprecated]] .BI "int rexec_af(char **restrict " ahost ", int " inport , .BI " const char *restrict " user ", const char *restrict " passwd , .BI " const char *restrict " cmd ", int *restrict " fd2p , .BI " sa_family_t " af ); .fi .P .BR rexec (), .BR rexec_af (): .nf Since glibc 2.19: _DEFAULT_SOURCE In glibc up to and including 2.19: _BSD_SOURCE .fi .SH DESCRIPTION This interface is obsoleted by .BR rcmd (3). .P The .BR rexec () function looks up the host .I *ahost using .BR gethostbyname (3), returning \-1 if the host does not exist. Otherwise, .I *ahost is set to the standard name of the host. If a username and password are both specified, then these are used to authenticate to the foreign host; otherwise the environment and then the .I .netrc file in user's home directory are searched for appropriate information. If all this fails, the user is prompted for the information. .P The port .I inport specifies which well-known DARPA Internet port to use for the connection; the call .I "getservbyname(""exec"", ""tcp"")" (see .BR getservent (3)) will return a pointer to a structure that contains the necessary port. The protocol for connection is described in detail in .BR rexecd (8). .P If the connection succeeds, a socket in the Internet domain of type .B SOCK_STREAM is returned to the caller, and given to the remote command as .I stdin and .IR stdout . If .I fd2p is nonzero, then an auxiliary channel to a control process will be setup, and a file descriptor for it will be placed in .IR *fd2p . The control process will return diagnostic output from the command (unit 2) on this channel, and will also accept bytes on this channel as being UNIX signal numbers, to be forwarded to the process group of the command. The diagnostic information returned does not include remote authorization failure, as the secondary connection is set up after authorization has been verified. If .I fd2p is 0, then the .I stderr (unit 2 of the remote command) will be made the same as the .I stdout and no provision is made for sending arbitrary signals to the remote process, although you may be able to get its attention by using out-of-band data. .SS rexec_af() The .BR rexec () function works over IPv4 .RB ( AF_INET ). By contrast, the .BR rexec_af () function provides an extra argument, .IR af , that allows the caller to select the protocol. This argument can be specified as .BR AF_INET , .BR AF_INET6 , or .B AF_UNSPEC (to allow the implementation to select the protocol). .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ .na .nh .BR rexec (), .BR rexec_af () T} Thread safety MT-Unsafe .TE .SH STANDARDS None. .SH HISTORY .TP .BR rexec () 4.2BSD, BSD, Solaris. .TP .BR rexec_af () glibc 2.2. .SH BUGS The .BR rexec () function sends the unencrypted password across the network. .P The underlying service is considered a big security hole and therefore not enabled on many sites; see .BR rexecd (8) for explanations. .SH SEE ALSO .BR rcmd (3), .BR rexecd (8)