RCMD(TC) UNIX System V
Name
rcmd - Remote shell command execution
Syntax
rcmd node [-l user] [-n] [command]
Description
rcmd sends command to node for execution. It passes the
resulting remote command its own standard input and outputs
the remote command's standard output and standard error.
Command can consist of more than one parameter. The second,
simplified form of the command is equivalent to the first,
but is only available if the system administrator previously
ran mkhosts(ADMN). Interrupt, quit, and terminate signals
received by rcmd are also received by the remote command;
rcmd normally terminates at the same time as the remote
command.
If command is omitted, rcmd simply runs rlogin(TC).
By default, the command belongs to the user on the remote
node with the same name as the user who ran rcmd. This
means that the resulting processes belong to the remote user
and begin with the remote user's home directory as their
working directory. Options permit you to specify another
user on node as the owner. In any case, the remote system
must have declared the local user equivalent to the remote
user: an entry in /etc/hosts.equiv or in a .rhosts file in
the current directory (normally the home directory) of the
target user will demonstrate equivalence. [See rcmd(SLIB).]
rcmd understands the following options:
-l user The command is to belong to user on node.
-n Prevent the remote command from blocking on
input by making its standard input be
/dev/null instead of the standard input of
rcmd.
If -n is not specified, rcmd reads the local
standard input, regardless of whether the
remote machine reads standard input.
Examples
The following command runs who on a node called ``central,''
putting the output in a file on the local machine.
rcmd central who > /tmp/c.who
The next example puts the same output on the remote machine.
rcmd central who \> /tmp/c.who
Files
$HOME/.rhosts (on the target machine)
/etc/hosts.equiv (on the target machine)
See Also
mkhosts(ADMN), rlogin(TC), rshd(ADMN), rhosts(SFF).
Requirements
rshd(ADMN) must be running on the target machine.
Notes
In some installations, this command is called rsh, so as to
be like other versions of the software.
Unlike rlogin and telnet, rcmd does not actually use a
pseudo-tty. The remote program can only read and/or write;
therefore, programs such as more or vi will hang. Hit the
<Break> key to continue.
Warnings
As the above examples illustrate, metacharacters to be
interpreted by the remote shell must be hidden from the
local shell. Thus:
rcmd central cd /etc ; cat passwd
clearly doesn't do what was intended because the semicolon
is interpreted by the local shell, not the remote shell, and
the remote shell never even sees the cat command. Either of
the following commands properly escapes the semicolon:
rcmd central cd /etc \; cat passwd
rcmd central 'cd /etc ; cat passwd'
Credit
This document was developed at the University of California
at Berkeley and is used with permission.
(printed 8/17/89) RCMD(TC)