RCMDSH(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

✨ NAME ✨

okay bestie, welcome to RCMDSH(3) from the Library Functions Manual β€” the page for rcmdsh: return a stream to a remote command without superuser.

🌸 SYNOPSIS 🌸

#include <unistd.h>

int
rcmdsh(char **ahost, int inport, const char *locuser,
    const char *remuser, const char *cmd, const char *rshprog);

πŸ¦‹ DESCRIPTION πŸ¦‹

So like, the rcmdsh() function is used by normal users to execute a command on a remote machine using an authentication scheme based on reserved port numbers using rshd(8) or the value of rshprog (if it's non-NULL). iconic behavior, honestly ✨

First it looks up the host *ahost using gethostbyname(3), and returns -1 if the host does not exist. Otherwise *ahost is set to the standard name of the host, and a connection is established to a server residing at the well-known Internet port β€œshell/tcp” (or whatever port is used by rshprog). the way that hostname lookup happens first is so real 🫢

Ngl, the inport argument is ignored β€” it is only included to provide an interface similar to rcmd(3). not me being decorative but still in the signature πŸ’…

If the connection succeeds, a socket in the Unix domain of type SOCK_STREAM is returned to the caller, and given to the remote command as stdin, stdout, and stderr. three streams, one socket, main character energy 🌈

πŸ’– RETURN VALUES πŸ’–

The rcmdsh() function returns a valid socket descriptor on success. Otherwise, -1 is returned and a diagnostic message is printed on the standard error. periodt πŸ’–

πŸ‘‘ SEE ALSO πŸ‘‘

the whole see-also coven: rsh(1), socketpair(2), rcmd(3), rshd(8) β€” go read those too, bestie πŸ‘‘ ✨

🌈 HISTORY 🌈

The rcmdsh() function first appeared in OpenBSD 2.0, and made its way into FreeBSD 4.6. a little cross-platform glow-up moment πŸ¦‹

πŸ’€ BUGS πŸ’€

🚨 bug alert: If rsh(1) encounters an error, a file descriptor is still returned instead of -1. that is not the vibe, but it is literally what the page says πŸ’€

muah πŸ’‹ this page is from Debian, dated September 1, 1996, and its manual name is RCMDSH(3) β€” go be iconic, bestie 🫢

πŸ“¦ where this page comes from