RSH(1C) — USER COMMANDS
NAME
rsh − remote shell
SYNOPSIS
rsh host [ −l username ] [ −n ] command
host [ −l username ] [ −n ] command
DESCRIPTION
rsh connects to the specified host, and executes the specified command. rsh copies its standard input to the remote command, the standard output of the remote command to its standard output, and the standard error of the remote command to its standard error. Interrupt, quit and terminate signals are propagated to the remote command; rsh normally terminates when the remote command does.
If you omit command, instead of executing a single command, rsh logs you in on the remote host using rlogin.
Shell metacharacters which are not quoted are interpreted on the local machine, while quoted metacharacters are interpreted on the remote machine. Thus the command:
tutorial% rsh lizard cat lizard.file >> tutorial.file
appends the remote file lizard.file from the machine called lizard to the file called tutorial.file on the machine called tutorial, while the command:
tutorial% rsh lizard cat lizard.file ">>" another.lizard.file
appends the file lizard.file on the machine called lizard to the file another.lizard.file. which also resides on the machine called lizard.
Host names are given in the file /etc/hosts. Each host has one standard name (the first name given in the file), which is rather long and unambiguous, and optionally one or more nicknames. The host names for machines to which your machine is networked are also found in the directory /usr/hosts, as symbolic links to rsh. If you put this directory in your search path then the rsh can be omitted.
OPTIONS
−l username
use username as the remote username instead of your local username. In the absence of this option, the remote username is the same as your local username, This remote name must be equivalent to the originating account. No provision is made for specifying a password with a command, and none is necessary — if your username is known at the remote end you will be admitted, otherwise you will be prompted for a password.
−n redirect the input of rsh to /dev/null. You sometimes need this option to avoid unfortunate interactions between rsh and the shell which invokes it. For example, if you are running csh and invoke a rsh in the background without redirecting its input away from the terminal, it will block even if no reads are posted by the remote command. The −n option will prevent this.
The type of remote shell (sh or csh) is determined by the user’s entry in the file /etc/passwd on the remote system.
FILES
/etc/hosts
/usr/hosts/∗
SEE ALSO
rlogin (1C)
BUGS
You cannot run an interactive command (like vi; use rlogin if you wish to do so.)
Stop signals stop the local rsh process only; this is arguably wrong, but currently hard to fix for reasons too complicated to explain here.
The current local environment is not passed to the remote shell.
Sometimes the −n option is needed for reasons that are less than obvious. For example, the command:
rsh somehost dd if=/dev/nrmt0 bs=20b | tar xvpBf -
will put your shell into a strange state. Evidently, what happens is that the tar terminates before the rsh. The rsh then tries to write into the "broken pipe" and, instead of terminating neatly, proceeds to compete with your shell for its standard input. Invoking rsh with the −n option avoids such incidents.
Note, however, that this bug occurs only when rsh is at the beginning of a pipeline and is not reading standard input. Don’t use the −n if the rsh actually needs to read standard input. For example,
tar cf - . | rsh sundial dd of=/dev/rmt0 obs=20b
doesn’t produce the bug. If you were to use the −n in a case like this, the rsh would incorrectly read from /dev/null instead of from the pipe.
Sun Release 3.2 — Last change: 23 September 1985