man-pages/man3/rexec.3

135 lines
4.6 KiB
Groff
Raw Normal View History

2005-11-03 14:27:02 +00:00
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)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 $
.\"
2005-11-03 14:29:44 +00:00
.\" Taken from FreeBSD 5.4; not checked against Linux reality (mtk)
.\"
.\" 2007-12-08, mtk, Converted from mdoc to man macros
2007-12-03 19:53:53 +00:00
.\"
.TH REXEC 3 2010-09-10 "Linux" "Linux Programmer's Manual"
2007-12-03 19:53:53 +00:00
.SH NAME
rexec \- return stream to a remote command
.SH SYNOPSIS
.nf
.BR "#define _BSD_SOURCE" " /* See feature_test_macros(7) */"
.B #include <netdb.h>
2007-12-03 19:53:53 +00:00
.sp
.BI "int rexec(char **" ahost ", int " inport ", char *" user ", "
.BI " char *" passwd ", char *" cmd ", int *" fd2p );
.fi
.SH DESCRIPTION
2005-11-03 14:27:02 +00:00
This interface is obsoleted by
2007-12-03 19:53:53 +00:00
.BR rcmd (3).
2005-11-03 14:27:02 +00:00
The
2007-12-03 19:53:53 +00:00
.BR rexec ()
2005-11-03 14:27:02 +00:00
function
looks up the host
2007-12-03 19:53:53 +00:00
.IR *ahost
2005-11-03 14:27:02 +00:00
using
2007-12-03 19:53:53 +00:00
.BR gethostbyname (3),
2005-11-03 14:27:02 +00:00
returning \-1 if the host does not exist.
Otherwise
2007-12-03 19:53:53 +00:00
.IR *ahost
2005-11-03 14:27:02 +00:00
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 user's
2007-12-03 19:53:53 +00:00
.I .netrc
2005-11-03 14:27:02 +00:00
file in his
home directory are searched for appropriate information.
If all this fails, the user is prompted for the information.
.PP
2005-11-03 14:27:02 +00:00
The port
2007-12-03 19:53:53 +00:00
.I inport
2007-12-09 14:29:12 +00:00
specifies which well-known DARPA Internet port to use for
2005-11-03 14:27:02 +00:00
the connection; the call
2007-12-28 04:45:59 +00:00
.I "getservbyname(""exec"", ""tcp"")"
2005-11-03 14:27:02 +00:00
(see
2007-12-03 19:53:53 +00:00
.BR getservent (3))
2007-12-09 14:29:12 +00:00
will return a pointer to a structure that contains the necessary port.
2005-11-03 14:27:02 +00:00
The protocol for connection is described in detail in
2007-12-03 19:53:53 +00:00
.BR rexecd (8).
.PP
2005-11-03 14:27:02 +00:00
If the connection succeeds,
a socket in the Internet domain of type
2007-12-03 19:53:53 +00:00
.BR SOCK_STREAM
2005-11-03 14:27:02 +00:00
is returned to
the caller, and given to the remote command as
2007-12-03 19:53:53 +00:00
.IR stdin
2005-11-03 14:27:02 +00:00
and
2007-12-03 19:53:53 +00:00
.IR stdout .
2005-11-03 14:27:02 +00:00
If
2007-12-03 19:53:53 +00:00
.I fd2p
intro.1, time.1, adjtimex.2, capget.2, eventfd.2, fcntl.2, getrlimit.2, getsockopt.2, gettimeofday.2, intro.2, ioctl_list.2, ioperm.2, mlock.2, pivot_root.2, poll.2, prctl.2, ptrace.2, sched_setscheduler.2, select_tut.2, semget.2, sigaltstack.2, signalfd.2, sysctl.2, timer_settime.2, timerfd_create.2, wait.2, CPU_SET.3, argz_add.3, assert_perror.3, atexit.3, backtrace.3, bcmp.3, clearenv.3, ctime.3, dl_iterate_phdr.3, dlopen.3, ecvt.3, errno.3, error.3, ether_aton.3, exit.3, fenv.3, ferror.3, finite.3, flockfile.3, fnmatch.3, fpathconf.3, fpclassify.3, ftime.3, ftok.3, ftw.3, fwide.3, getaddrinfo.3, gethostbyname.3, getlogin.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getrpcent.3, getservent.3, glob.3, hsearch.3, inet.3, isalpha.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, longjmp.3, lsearch.3, malloc.3, matherr.3, mblen.3, mbsinit.3, mbtowc.3, on_exit.3, printf.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_equal.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedparam.3, pthread_setschedprio.3, ptsname.3, putenv.3, putgrent.3, raise.3, rcmd.3, regex.3, rexec.3, rpc.3, rpmatch.3, rtnetlink.3, scandir.3, sem_init.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, signbit.3, stdio_ext.3, strtod.3, strtol.3, strtoul.3, system.3, termios.3, timeradd.3, tzset.3, ualarm.3, wctomb.3, xdr.3, st.4, tty_ioctl.4, core.5, elf.5, proc.5, bootparam.7, capabilities.7, icmp.7, ip.7, ipv6.7, math_error.7, mdoc.samples.7, mq_overview.7, pthreads.7, raw.7, regex.7, socket.7, tcp.7, tzselect.8: Global fix: s/non-zero/nonzero/ The tendency in English, as prescribed in style guides like Chicago MoS, is towards removing hyphens after prefixes like "non-" etc. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:40:55 +00:00
is nonzero, then an auxiliary channel to a control
2005-11-03 14:27:02 +00:00
process will be setup, and a descriptor for it will be placed
in
2007-12-03 19:53:53 +00:00
.IR *fd2p .
2005-11-03 14:27:02 +00:00
The control process will return diagnostic
output from the command (unit 2) on this channel, and will also
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/ The man pages were rather inconsistent in the use of "Unix" versus "UNIX". Let's go with the trademark usage. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
accept bytes on this channel as being UNIX signal numbers, to be
2005-11-03 14:27:02 +00:00
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
2007-12-03 19:53:53 +00:00
.I fd2p
2005-11-03 14:27:02 +00:00
is 0, then the
2007-12-03 19:53:53 +00:00
.IR stderr
2005-11-03 14:27:02 +00:00
(unit 2 of the remote
command) will be made the same as the
2007-12-03 19:53:53 +00:00
.IR stdout
2005-11-03 14:27:02 +00:00
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.
2007-12-03 19:53:53 +00:00
.SH "CONFORMING TO"
Not in POSIX.1-2001.
Present on the BSDs, Solaris, and many other systems.
2005-11-03 14:27:02 +00:00
The
2007-12-03 19:53:53 +00:00
.BR rexec ()
2005-11-03 14:27:02 +00:00
function appeared in
2007-12-03 19:53:53 +00:00
4.2BSD.
.SH BUGS
2005-11-03 14:27:02 +00:00
The
2007-12-03 19:53:53 +00:00
.BR rexec ()
2005-11-03 14:27:02 +00:00
function sends the unencrypted password across the network.
.PP
2005-11-03 14:27:02 +00:00
The underlying service is considered a big security hole and therefore
not enabled on many sites, see
2007-12-03 19:53:53 +00:00
.BR rexecd (8)
2005-11-03 14:27:02 +00:00
for explanations.
2007-12-03 19:53:53 +00:00
.SH SEE ALSO
.BR rcmd (3),
.BR rexecd (8)