1.\" $NetBSD: rcmd.1,v 1.19 2008/05/30 02:29:37 mrg Exp $ 2.\" 3.\" Copyright (c) 1997 Matthew R. Green. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.\" Copyright (c) 1983, 1990 The Regents of the University of California. 28.\" All rights reserved. 29.\" 30.\" Redistribution and use in source and binary forms, with or without 31.\" modification, are permitted provided that the following conditions 32.\" are met: 33.\" 1. Redistributions of source code must retain the above copyright 34.\" notice, this list of conditions and the following disclaimer. 35.\" 2. Redistributions in binary form must reproduce the above copyright 36.\" notice, this list of conditions and the following disclaimer in the 37.\" documentation and/or other materials provided with the distribution. 38.\" 3. Neither the name of the University nor the names of its contributors 39.\" may be used to endorse or promote products derived from this software 40.\" without specific prior written permission. 41.\" 42.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 43.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 44.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 45.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 46.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 47.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 48.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 49.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 50.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 51.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 52.\" SUCH DAMAGE. 53.\" 54.\" from: @(#)rsh.1 6.10 (Berkeley) 7/24/91 55.\" from: NetBSD: rsh.1,v 1.3 1997/01/09 20:21:14 tls Exp 56.\" 57.Dd September 5, 2004 58.Dt RCMD 1 59.Os 60.Sh NAME 61.Nm rcmd 62.Nd backend driver for 63.Xr rcmd 3 64.Sh SYNOPSIS 65.Nm 66.Op Fl l Ar username 67.Op Fl u Ar localusername 68.Ar host 69.Ar command 70.Sh DESCRIPTION 71.Nm 72executes 73.Ar command 74on 75.Ar host . 76.Pp 77.Nm 78copies its standard input to the remote command, the standard 79output of the remote command to its standard output, and the 80standard error of the remote command to its standard error. 81Interrupt, quit and terminate signals are propagated to the remote 82command; 83.Nm 84normally terminates when the remote command does. 85The options are as follows: 86.Bl -tag -width flag 87.It Fl d 88The 89.Fl d 90option turns on socket debugging (using 91.Xr setsockopt 2 ) 92on the 93.Tn TCP 94sockets used for communication with the remote host. 95.It Fl l 96By default, the remote username is the same as the local username. 97The 98.Fl l 99option allows the remote name to be specified. 100.It Fl u 101The 102.Fl u 103option allows the local username to be specified. 104Only the superuser is allowed to use this option. 105.It Fl n 106The 107.Fl n 108option redirects input from the special device 109.Pa /dev/null 110(see the 111.Sx BUGS 112section of this manual page). 113.El 114.Pp 115Shell metacharacters which are not quoted are interpreted on local machine, 116while quoted metacharacters are interpreted on the remote machine. 117For example, the command 118.Pp 119.Dl rcmd otherhost cat remotefile \*[Gt]\*[Gt] localfile 120.Pp 121appends the remote file 122.Ar remotefile 123to the local file 124.Ar localfile , 125while 126.Pp 127.Dl rcmd otherhost cat remotefile \&"\*[Gt]\*[Gt]\&" other_remotefile 128.Pp 129appends 130.Ar remotefile 131to 132.Ar other_remotefile . 133.Sh FILES 134.Bl -tag -width /etc/hosts -compact 135.It Pa /etc/hosts 136.El 137.Sh SEE ALSO 138.Xr rsh 1 , 139.Xr rcmd 3 , 140.Xr environ 7 141.Sh HISTORY 142The 143.Nm 144command appeared in 145.Nx 1.3 146and is primarily derived from 147.Xr rsh 1 . 148Its purpose was to create a backend driver for 149.Xr rcmd 3 150that would allow the users of 151.Xr rcmd 3 152to no longer require super-user privileges. 153.Sh BUGS 154If you are using 155.Xr csh 1 156and put a 157.Nm 158in the background without redirecting its input away from the terminal, 159it will block even if no reads are posted by the remote command. 160If no input is desired you should redirect the input of 161.Nm 162to 163.Pa /dev/null 164using the 165.Fl n 166option. 167.Pp 168You cannot use 169.Nm rcmd 170to run an interactive command (like 171.Xr rogue 6 172or 173.Xr vi 1 ) . 174Use 175.Xr rlogin 1 176instead. 177.Pp 178The stop signal, 179.Dv SIGSTOP , 180will stop the local 181.Nm 182process only. 183This is arguably wrong, but currently hard to fix for reasons 184too complicated to explain here. 185