Linux and Unix rsh command

Quick links

About rsh
Syntax
Examples
Related commands
Linux and Unix main page

About rsh

rsh executes commands on a remote shell.

Syntax

rsh host [-l username] [-n] [-d] [-k realm] [-f | -F] [-x] [-PN | -PO] 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.

Individual users can keep a private authorization list in a file named .k5login in their (remote) home directory. Each line in this file should contain a Kerberos principal name of the form principal/instance@realm. If there is a ~/.k5login file, access is granted to the account if and only if the originater user is authenticated to one of the princiapls named in the ~/.k5login file.

Options

-l username Sets the remote username to username. Otherwise, the remote username will be the same as the local username.
-x Causes the network session traffic to be encrypted. This applies only to the input and output streams, and not the command line.
-f Cause nonforwardable Kerberos credentials to be forwarded to the remote machine for use by the specified command. They will be removed when command finishes. This option is mutually exclusive with the -F option.
-F Cause forwardable Kerberos credentials to be forwarded to the remote machine for use by the specified command. They will be removed when command finishes. This option is mutually exclusive with the -f option.
-k realm Causes rsh to obtain tickets for the remote host in realm instead of the remote host’s realm, as determined by krb_real-mofhost.
-d Turns on socket debugging on the TCP sockets used for communication with the remote host.
-n Redirects input from /dev/null.
-PN, -PO Explicitly request new or old version of the Kerberos "rcmd" protocol. The new protocol avoids many security problems found in the old one, but is not interoperable with older servers. (An "input/output error" and a closed connection is the most likely result of attempting this combination.) If neither option is specified, some simple heuristics are used to guess which to try.

If you omit command, then instead of executing a single command, you will be logged 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. For example, the following command:

rsh otherhost cat remotefile >> localfile

appends the remote file remotefile to the local file localfile, while:

rsh otherhost cat remotefile ">>" otherremotefile

...appends remotefile to otherremotefile.

Please note that interactive commands, such as a text editor, cannot be executed remotely with rsh; use rlogin instead.

Files

/etc/hosts The hostname map definitions file.
~/.k5login On the remote host, this file may be used to define the Kerberos principals that are allowed access.

Examples

rsh example-host.com ls

Executes the ls command on host example-host.com, using the local user name as the remote login name.

Related commands

on — Execute a command on a remote system, but with the local environment.
rlogin — Begin a session on a remote system.
telnet — Connect to a remote system using the telnet protocol.