rcmd(TC) 19 June 1992 rcmd(TC) Name rcmd - remote shell command execution Syntax rcmd node [-l user] [-n] [command] /usr/hosts/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 parame- ter. 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 pro- cesses 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 rcmd's standard input. If -n is not specified, rcmd reads the local standard input regardless of whether the remote machine reads standard input. Files $HOME/.rhosts (on the target machine) /etc/hosts.equiv (on the target machine) 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 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. 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 does not do what was intended because the semicolon is inter- preted by the local shell, not the remote shell, and the remote shell never even sees the cat command. Either of the following commands prop- erly escapes the semicolon: rcmd central cd /etc \; cat passwd rcmd central 'cd /etc ; cat passwd' See also mkhosts(ADMN), rlogin(TC), rshd(ADMN), rhosts(SFF).