1*01869ca4Swiz.\" $NetBSD: rcmd.1,v 1.22 2017/07/03 21:33:23 wiz Exp $ 243b97d82Smrg.\" 3b2b49933Sagc.\" Copyright (c) 1997 Matthew R. Green. 404f2afbeSmrg.\" All rights reserved. 504f2afbeSmrg.\" 604f2afbeSmrg.\" Redistribution and use in source and binary forms, with or without 704f2afbeSmrg.\" modification, are permitted provided that the following conditions 804f2afbeSmrg.\" are met: 904f2afbeSmrg.\" 1. Redistributions of source code must retain the above copyright 1004f2afbeSmrg.\" notice, this list of conditions and the following disclaimer. 1104f2afbeSmrg.\" 2. Redistributions in binary form must reproduce the above copyright 1204f2afbeSmrg.\" notice, this list of conditions and the following disclaimer in the 1304f2afbeSmrg.\" documentation and/or other materials provided with the distribution. 1404f2afbeSmrg.\" 1504f2afbeSmrg.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1604f2afbeSmrg.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1704f2afbeSmrg.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1804f2afbeSmrg.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1904f2afbeSmrg.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2004f2afbeSmrg.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 2104f2afbeSmrg.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2204f2afbeSmrg.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2304f2afbeSmrg.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2404f2afbeSmrg.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2504f2afbeSmrg.\" SUCH DAMAGE. 2604f2afbeSmrg.\" 2743b97d82Smrg.\" Copyright (c) 1983, 1990 The Regents of the University of California. 2843b97d82Smrg.\" All rights reserved. 2943b97d82Smrg.\" 3043b97d82Smrg.\" Redistribution and use in source and binary forms, with or without 3143b97d82Smrg.\" modification, are permitted provided that the following conditions 3243b97d82Smrg.\" are met: 3343b97d82Smrg.\" 1. Redistributions of source code must retain the above copyright 3443b97d82Smrg.\" notice, this list of conditions and the following disclaimer. 3543b97d82Smrg.\" 2. Redistributions in binary form must reproduce the above copyright 3643b97d82Smrg.\" notice, this list of conditions and the following disclaimer in the 3743b97d82Smrg.\" documentation and/or other materials provided with the distribution. 38b5b29542Sagc.\" 3. Neither the name of the University nor the names of its contributors 39b5b29542Sagc.\" may be used to endorse or promote products derived from this software 40b5b29542Sagc.\" without specific prior written permission. 41b5b29542Sagc.\" 42b5b29542Sagc.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 43b5b29542Sagc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 44b5b29542Sagc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 45b5b29542Sagc.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 46b5b29542Sagc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 47b5b29542Sagc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 48b5b29542Sagc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 49b5b29542Sagc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 50b5b29542Sagc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 51b5b29542Sagc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 52b5b29542Sagc.\" SUCH DAMAGE. 53b5b29542Sagc.\" 5443b97d82Smrg.\" from: @(#)rsh.1 6.10 (Berkeley) 7/24/91 5543b97d82Smrg.\" from: NetBSD: rsh.1,v 1.3 1997/01/09 20:21:14 tls Exp 5643b97d82Smrg.\" 57cd6d8c74Swiz.Dd May 31, 2011 5843b97d82Smrg.Dt RCMD 1 59f1247650Sgarbled.Os 6043b97d82Smrg.Sh NAME 6143b97d82Smrg.Nm rcmd 6243b97d82Smrg.Nd backend driver for 630e1f9af4Swiz.Xr rcmd 3 6443b97d82Smrg.Sh SYNOPSIS 65c3872193Senami.Nm 66ef4ded4aSchristos.Op Fl 46dn 6743b97d82Smrg.Op Fl l Ar username 68cd6d8c74Swiz.Op Fl p Ar port 6943b97d82Smrg.Op Fl u Ar localusername 7043b97d82Smrg.Ar host 7143b97d82Smrg.Ar command 7243b97d82Smrg.Sh DESCRIPTION 7343b97d82Smrg.Nm 7443b97d82Smrgexecutes 7543b97d82Smrg.Ar command 7643b97d82Smrgon 7743b97d82Smrg.Ar host . 7843b97d82Smrg.Pp 79c3872193Senami.Nm 8043b97d82Smrgcopies its standard input to the remote command, the standard 8143b97d82Smrgoutput of the remote command to its standard output, and the 8243b97d82Smrgstandard error of the remote command to its standard error. 8343b97d82SmrgInterrupt, quit and terminate signals are propagated to the remote 8443b97d82Smrgcommand; 8543b97d82Smrg.Nm 8643b97d82Smrgnormally terminates when the remote command does. 8743b97d82SmrgThe options are as follows: 8843b97d82Smrg.Bl -tag -width flag 89ef4ded4aSchristos.It Fl 4 90ef4ded4aSchristosUse IPv4 addresses only. 91ef4ded4aSchristos.It Fl 6 92ef4ded4aSchristosUse IPv6 addresses only. 9343b97d82Smrg.It Fl d 9443b97d82SmrgThe 9543b97d82Smrg.Fl d 9643b97d82Smrgoption turns on socket debugging (using 9743b97d82Smrg.Xr setsockopt 2 ) 9843b97d82Smrgon the 9943b97d82Smrg.Tn TCP 10043b97d82Smrgsockets used for communication with the remote host. 10143b97d82Smrg.It Fl l 10243b97d82SmrgBy default, the remote username is the same as the local username. 10343b97d82SmrgThe 10443b97d82Smrg.Fl l 10543b97d82Smrgoption allows the remote name to be specified. 106ef4ded4aSchristosAnother possible way to specify the remote username 107ef4ded4aSchristosis the notation 108ef4ded4aSchristos.Ar user@host . 10943b97d82Smrg.It Fl n 11043b97d82SmrgThe 11143b97d82Smrg.Fl n 11243b97d82Smrgoption redirects input from the special device 11343b97d82Smrg.Pa /dev/null 11443b97d82Smrg(see the 11543b97d82Smrg.Sx BUGS 11643b97d82Smrgsection of this manual page). 117ef4ded4aSchristos.It Fl p Ar port 118ef4ded4aSchristosUses the given 119ef4ded4aSchristos.Pa port 120ef4ded4aSchristosinstead of the one assigned to the service 121ef4ded4aSchristos.Dq shell . 122ef4ded4aSchristosMay be given either as symbolic name or as number. 123cd6d8c74Swiz.It Fl u 124cd6d8c74SwizThe 125cd6d8c74Swiz.Fl u 126cd6d8c74Swizoption allows the local username to be specified. 127cd6d8c74SwizOnly the superuser is allowed to use this option. 12843b97d82Smrg.El 12943b97d82Smrg.Pp 13043b97d82SmrgShell metacharacters which are not quoted are interpreted on local machine, 13143b97d82Smrgwhile quoted metacharacters are interpreted on the remote machine. 13243b97d82SmrgFor example, the command 13343b97d82Smrg.Pp 134*01869ca4Swiz.Dl rcmd otherhost cat remotefile >> localfile 13543b97d82Smrg.Pp 13643b97d82Smrgappends the remote file 13743b97d82Smrg.Ar remotefile 13843b97d82Smrgto the local file 13943b97d82Smrg.Ar localfile , 14043b97d82Smrgwhile 14143b97d82Smrg.Pp 142*01869ca4Swiz.Dl rcmd otherhost cat remotefile \&">>\&" other_remotefile 14343b97d82Smrg.Pp 14443b97d82Smrgappends 14543b97d82Smrg.Ar remotefile 14643b97d82Smrgto 14743b97d82Smrg.Ar other_remotefile . 14843b97d82Smrg.Sh FILES 14943b97d82Smrg.Bl -tag -width /etc/hosts -compact 15043b97d82Smrg.It Pa /etc/hosts 15143b97d82Smrg.El 15243b97d82Smrg.Sh SEE ALSO 15343b97d82Smrg.Xr rsh 1 , 1549014bdbcSlukem.Xr rcmd 3 , 15589fb08a9Swiz.Xr environ 7 15643b97d82Smrg.Sh HISTORY 15743b97d82SmrgThe 15843b97d82Smrg.Nm 15943b97d82Smrgcommand appeared in 1606da8e8dcSscottr.Nx 1.3 1616da8e8dcSscottrand is primarily derived from 16243b97d82Smrg.Xr rsh 1 . 1636da8e8dcSscottrIts purpose was to create a backend driver for 164bf8f52b9Smrg.Xr rcmd 3 165bf8f52b9Smrgthat would allow the users of 166bf8f52b9Smrg.Xr rcmd 3 167bf8f52b9Smrgto no longer require super-user privileges. 16843b97d82Smrg.Sh BUGS 16943b97d82SmrgIf you are using 17043b97d82Smrg.Xr csh 1 17143b97d82Smrgand put a 17243b97d82Smrg.Nm 17343b97d82Smrgin the background without redirecting its input away from the terminal, 17443b97d82Smrgit will block even if no reads are posted by the remote command. 17543b97d82SmrgIf no input is desired you should redirect the input of 17643b97d82Smrg.Nm 17743b97d82Smrgto 17843b97d82Smrg.Pa /dev/null 17943b97d82Smrgusing the 18043b97d82Smrg.Fl n 18143b97d82Smrgoption. 18243b97d82Smrg.Pp 1836da8e8dcSscottrYou cannot use 1846da8e8dcSscottr.Nm rcmd 1856da8e8dcSscottrto run an interactive command (like 18643b97d82Smrg.Xr rogue 6 18743b97d82Smrgor 1886da8e8dcSscottr.Xr vi 1 ) . 1896da8e8dcSscottrUse 19043b97d82Smrg.Xr rlogin 1 19143b97d82Smrginstead. 19243b97d82Smrg.Pp 1936da8e8dcSscottrThe stop signal, 1946da8e8dcSscottr.Dv SIGSTOP , 1956da8e8dcSscottrwill stop the local 19643b97d82Smrg.Nm 19714dfaa4bSwizprocess only. 19814dfaa4bSwizThis is arguably wrong, but currently hard to fix for reasons 19943b97d82Smrgtoo complicated to explain here. 200