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 ๐Ÿ‘€

rcmd(3), rexecd(8)


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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms