|RCMDSH(3)||Library Functions Manual||RCMDSH(3)|
rcmdsh — return a
stream to a remote command without superuser
inport, const char
*locuser, const char
*remuser, const char
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
ssh(1) or the value of
rshprog (if non-null). rshprog
may be a fully-qualified path, a non-qualified command, or a command
containing space-separated command line arguments.
rcmdsh() function looks up the host
getaddrinfo(3) and, if
the host exists, *ahost is set to the canonical name
of the host. A connection is then established to a server residing at the
well-known Internet port
shell/tcp (or whatever port
is used by rshprog). The parameter
inport is ignored; it is only included to provide an
interface similar to
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 and stdout, and stderr.
rcmdsh() function returns a valid
socket descriptor on success. It returns -1 on error and prints a diagnostic
message on the standard error.
rcmdsh() function first appeared in
If ssh(1) encounters an error, a file descriptor is still returned instead of -1.
|May 28, 2016||OpenBSD-6.1|