1.\" $NetBSD: rsh.1,v 1.20 2005/03/11 02:45:24 ginsbach Exp $ 2.\" 3.\" Copyright (c) 1983, 1990, 1993 4.\" The Regents of the University of California. 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.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)rsh.1 8.2 (Berkeley) 4/29/95 31.\" 32.Dd March 9, 2005 33.Dt RSH 1 34.Os 35.Sh NAME 36.Nm rsh 37.Nd remote shell 38.Sh SYNOPSIS 39.Nm 40.Op Fl 46dn 41.Op Fl l Ar username 42.Op Fl p Ar port 43.Ar host 44.Op command 45.Nm 46.Op Fl 46dn 47.Op Fl p Ar port 48.Ar username@host 49.Op command 50.Sh DESCRIPTION 51.Nm 52executes 53.Ar command 54on 55.Ar host . 56.Pp 57.Nm 58copies its standard input to the remote command, the standard 59output of the remote command to its standard output, and the 60standard error of the remote command to its standard error. 61Interrupt, quit and terminate signals are propagated to the remote 62command; 63.Nm 64normally terminates when the remote command does. 65The options are as follows: 66.Bl -tag -width XlXusernameX 67.It Fl 4 68Use IPv4 addresses only. 69.It Fl 6 70Use IPv6 addresses only. 71.It Fl d 72The 73.Fl d 74option turns on socket debugging (using 75.Xr setsockopt 2 ) 76on the 77.Tn TCP 78sockets used for communication with the remote host. 79.It Fl l Ar username 80By default, the remote username is the same as the local username. 81The 82.Fl l 83option or the 84.Ar username@host 85format allow the remote name to be specified. 86.It Fl n 87The 88.Fl n 89option redirects input from the special device 90.Pa /dev/null 91(see the 92.Sx BUGS 93section of this manual page). 94.It Fl p Ar port 95Uses the given 96.Pa port 97instead of the one assigned to the service 98.Dq shell . 99May be given either as symbolic name or as number. 100If no command is given, note that 101.Xr rlogin 1 102is started, which may need a different daemon 103.No ( Xr rlogind 8 104instead of 105.Xr rshd 8 ) 106running on the server; you want to pass the 107.Xr rshd 8 108port number in that case. 109.El 110.Pp 111If no 112.Ar command 113is specified, you will be logged in on the remote host using 114.Xr rlogin 1 . 115.Pp 116Shell metacharacters which are not quoted are interpreted on local machine, 117while quoted metacharacters are interpreted on the remote machine. 118For example, the command 119.Pp 120.Dl rsh otherhost cat remotefile \*[Gt]\*[Gt] localfile 121.Pp 122appends the remote file 123.Ar remotefile 124to the local file 125.Ar localfile , 126while 127.Pp 128.Dl rsh otherhost cat remotefile \&"\*[Gt]\*[Gt]\&" other_remotefile 129.Pp 130appends 131.Ar remotefile 132to 133.Ar other_remotefile . 134.\" .Pp 135.\" Many sites specify a large number of host names as commands in the 136.\" directory 137.\" .Pa /usr/hosts . 138.\" If this directory is included in your search path, you can use the 139.\" shorthand 140.\" .Dq host command 141.\" for the longer form 142.\" .Dq rsh host command . 143.Sh FILES 144.Bl -tag -width /etc/hosts -compact 145.It Pa /etc/hosts 146.El 147.Sh SEE ALSO 148.Xr rcmd 1 , 149.Xr rlogin 1 , 150.Xr rcmd 3 , 151.Xr hosts.equiv 5 , 152.Xr rhosts 5 , 153.Xr environ 7 154.Sh HISTORY 155The 156.Nm 157command appeared in 158.Bx 4.2 . 159.Sh BUGS 160If you are using 161.Xr csh 1 162and put a 163.Nm 164in the background without redirecting its input away from the terminal, 165it will block even if no reads are posted by the remote command. 166If no input is desired you should redirect the input of 167.Nm 168to 169.Pa /dev/null 170using the 171.Fl n 172option. 173.Pp 174You cannot run an interactive command (like 175.Xr rogue 6 176or 177.Xr vi 1 ) 178using 179.Nm ; 180use 181.Xr rlogin 1 182instead. 183.Pp 184Stop signals stop the local 185.Nm 186process only; this is arguably wrong, but currently hard to fix for reasons 187too complicated to explain here. 188