Modular Computers the manual GitHub

rsh

rsh: run a command or a shell on another computer.

Synopsis

rsh [-n] host [command…]

Description

rsh connects to rshd(1) on another computer, over its network cards (TCP, port 514). host is the other computer’s name (its hostname(1)), or its network card id (lsdev -i shows it), whole, or as much of its start as names one computer that answers (rsh asks every rshd in reach, and each answers with its name); a * at its end is allowed. A name said in full wins over an id’s start.

With a command (its words joined by spaces), the other computer’s sh -c runs it. Its input is rsh’s (none with -n), its output and errors are rsh’s, apart, and rsh ends as it did: its exit status, or 128 and the signal’s number if a signal ended it.

With no command, a login: a shell on a pty on the other computer, as big as this terminal. This terminal goes raw, so every key goes there as it’s typed, ^C and the arrows included; a change of this terminal’s size (SIGWINCH) goes there too. ~. at the start of a line disconnects, and ~~ sends one ~.

Options

-n
No input for the command (as from /dev/null).

Exit status

The command’s, or the shell’s; 1 when the host isn’t found, the connection fails, or it’s lost.

Examples

rsh 1b9c0e uptime
rsh 1b9c0e
cat notes | rsh 1b9c0e 'cat > /notes'

Notes

Berkeley’s r-commands are its model: no passwords and no encryption (anyone whose card reaches the other computer’s can do this), which is why their names were kept, and not ssh’s. BSD’s rsh sent errors on a second connection, never told how the command ended, and ran rlogin when given no command; this one sends everything on one connection, framed, ends as the command did, and logs in itself. It speaks only to mcos’s rshd.

See also

rshd(1), rcp(1), rc(1)