rexec(3)
๐ rexec โ the "talk to a remote command" girlie ๐
okay so bestie, welcome to rexec(3) from the Library Functions Manual โจ this is the rexec / rexec_af page and yes it's giving "vintage" in the way that vintage means deprecated ๐ buckle up, grab a ๐, and let's go.
โจ NAME โจ
rexec, rexec_af โ return stream to a remote command ๐ซถ
๐ LIBRARY ๐
Standard C library (libc, -lc) ๐
๐ SYNOPSIS ๐
#include <netdb.h>
[[deprecated]]
int rexec(char **restrict ahost, int inport,
const char *restrict user, const char *restrict passwd,
const char *restrict cmd, int *restrict fd2p);
[[deprecated]]
int rexec_af(char **restrict ahost, int inport,
const char *restrict user, const char *restrict passwd,
const char *restrict cmd, int *restrict fd2p,
sa_family_t af);
Feature-test macro realness for rexec(), rexec_af():
- Since glibc 2.19:
_DEFAULT_SOURCE - In glibc up to and including 2.19:
_BSD_SOURCE
๐ธ DESCRIPTION ๐ธ
so first thing first, bestie: this interface is obsoleted by rcmd(3). no cap. it's the older sister that got replaced and she knows it ๐ญ
The rexec() function looks up the host *ahost using gethostbyname(3), and it returns -1 if the host does not exist. otherwise, *ahost gets set to the standard name of the host. iconic behavior.
If a username and password are both specified, then these are used to authenticate to the foreign host. otherwise, the environment gets searched first, and then the .netrc file in the user's home directory, looking for the appropriate information. and if all of that fails?? the user gets prompted for the information. awkward but okay ๐
The port inport specifies which well-known DARPA Internet port to use for the connection. the call getservbyname("exec", "tcp") (see getservent(3)) will return a pointer to a structure that contains the necessary port. the protocol for connection is described in detail in rexecd(8).
If the connection succeeds, a socket in the Internet domain of type SOCK_STREAM is returned to the caller, and given to the remote command as stdin and stdout. slay.
If fd2p is nonzero, then an auxiliary channel to a control process will be set up, and a file descriptor for it will be placed in *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. ๐
real talk though: the diagnostic information returned does not include remote authorization failure, because the secondary connection is set up after authorization has been verified. order of operations, periodt.
If fd2p is 0, then the stderr (unit 2 of the remote command) will be made the same as the 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. it's giving "we have options but not great ones" ๐
๐ฆ rexec_af() ๐ฆ
The rexec() function works over IPv4 (AF_INET). By contrast, the rexec_af() function provides an extra argument, af, that allows the caller to select the protocol. This argument can be specified as AF_INET, AF_INET6, or AF_UNSPEC (to allow the implementation to select the protocol). choose your own adventure, bestie ๐
๐ ATTRIBUTES ๐
For an explanation of the terms used in this section, see attributes(7).
rexec(),rexec_af()โ Attribute: Thread safety โ Value:MT-Unsafeโญ
yes bb, MT-Unsafe. thread safety said "not me" and left the group chat ๐
๐ STANDARDS ๐
None. literally none. she's untethered ๐ง
๐ฐ๏ธ HISTORY ๐ฐ๏ธ
rexec()โ4.2BSD,BSD,Solaris.rexec_af()โ glibc 2.2.
๐ BUGS ๐
The rexec() function sends the unencrypted password across the network. ๐จ like, in the clear. in the open. for everyone. bestie NO.
The underlying service is considered a big security hole, and therefore, not enabled on many sites; see rexecd(8) for explanations. and honestly? fair. it's giving haunted house energy ๐ป
โ ๏ธ if you take nothing else from this page: unencrypted passwords on the wire is a big red flag, and the service behind it is widely regarded as a serious security problem โ which is exactly why a lot of sites just don't turn it on.
๐ SEE ALSO ๐
okay that's the whole page, you ate that ๐ซถ this was Linux man-pages 6.20, dated 2025-09-21, signing off with a ๐ and a reminder to maybe use rcmd(3) instead, iykyk ๐
โจ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: BSD-4-Clause-UC
- Copyright 1983-1993, The Regents of the University of California
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms