1.\" $NetBSD: rcmd.1,v 1.22 2017/07/03 21:33:23 wiz 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 May 31, 2011 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 46dn 67.Op Fl l Ar username 68.Op Fl p Ar port 69.Op Fl u Ar localusername 70.Ar host 71.Ar command 72.Sh DESCRIPTION 73.Nm 74executes 75.Ar command 76on 77.Ar host . 78.Pp 79.Nm 80copies its standard input to the remote command, the standard 81output of the remote command to its standard output, and the 82standard error of the remote command to its standard error. 83Interrupt, quit and terminate signals are propagated to the remote 84command; 85.Nm 86normally terminates when the remote command does. 87The options are as follows: 88.Bl -tag -width flag 89.It Fl 4 90Use IPv4 addresses only. 91.It Fl 6 92Use IPv6 addresses only. 93.It Fl d 94The 95.Fl d 96option turns on socket debugging (using 97.Xr setsockopt 2 ) 98on the 99.Tn TCP 100sockets used for communication with the remote host. 101.It Fl l 102By default, the remote username is the same as the local username. 103The 104.Fl l 105option allows the remote name to be specified. 106Another possible way to specify the remote username 107is the notation 108.Ar user@host . 109.It Fl n 110The 111.Fl n 112option redirects input from the special device 113.Pa /dev/null 114(see the 115.Sx BUGS 116section of this manual page). 117.It Fl p Ar port 118Uses the given 119.Pa port 120instead of the one assigned to the service 121.Dq shell . 122May be given either as symbolic name or as number. 123.It Fl u 124The 125.Fl u 126option allows the local username to be specified. 127Only the superuser is allowed to use this option. 128.El 129.Pp 130Shell metacharacters which are not quoted are interpreted on local machine, 131while quoted metacharacters are interpreted on the remote machine. 132For example, the command 133.Pp 134.Dl rcmd otherhost cat remotefile >> localfile 135.Pp 136appends the remote file 137.Ar remotefile 138to the local file 139.Ar localfile , 140while 141.Pp 142.Dl rcmd otherhost cat remotefile \&">>\&" other_remotefile 143.Pp 144appends 145.Ar remotefile 146to 147.Ar other_remotefile . 148.Sh FILES 149.Bl -tag -width /etc/hosts -compact 150.It Pa /etc/hosts 151.El 152.Sh SEE ALSO 153.Xr rsh 1 , 154.Xr rcmd 3 , 155.Xr environ 7 156.Sh HISTORY 157The 158.Nm 159command appeared in 160.Nx 1.3 161and is primarily derived from 162.Xr rsh 1 . 163Its purpose was to create a backend driver for 164.Xr rcmd 3 165that would allow the users of 166.Xr rcmd 3 167to no longer require super-user privileges. 168.Sh BUGS 169If you are using 170.Xr csh 1 171and put a 172.Nm 173in the background without redirecting its input away from the terminal, 174it will block even if no reads are posted by the remote command. 175If no input is desired you should redirect the input of 176.Nm 177to 178.Pa /dev/null 179using the 180.Fl n 181option. 182.Pp 183You cannot use 184.Nm rcmd 185to run an interactive command (like 186.Xr rogue 6 187or 188.Xr vi 1 ) . 189Use 190.Xr rlogin 1 191instead. 192.Pp 193The stop signal, 194.Dv SIGSTOP , 195will stop the local 196.Nm 197process only. 198This is arguably wrong, but currently hard to fix for reasons 199too complicated to explain here. 200