rsh

This connectivity command runs commands on remote hosts running the rsh service. For information about the .rhosts file, see the Rcp command.

Syntax

rsh host[-l username] [-n] command

Parameters

host

-l username

Specifies the user name to use on the remote host. If omitted, the logged-on user name is used.

-n

Redirects the input of rsh to NUL.

command

Specifies the command to run.

Notes

Rsh copies standard input to the remote command, standard output of the remote command to its standard output, and the standard error of the remote command to its standard error. Rsh normally terminates when the remote command does.

Using Redirection Symbols

Use quotation marks around redirection symbols to redirect onto the remote host. If quotation marks are not used, redirection occurs on the local computer. For example, the following command appends the remote file remotefile to the local file localfile:


rsh otherhost cat remotefile >> localfile

The following command appends the remote file remotefile to the remote file otherremotefile:


rsh otherhost cat remotefile ">>" otherremotefile

Using Rsh on a Windows NT Server Domain

If the user is logged on to a Windows NT Server domain, the domain controller must be available to resolve the currently logged-on name, because the logged-on name is not cached on the local computer. Because the username is required as part of the rsh protocol, the command fails if the username cannot be obtained.

The .rhosts File

The .rhosts file generally permits network access rights on UNIX computers. The .rhosts file lists computer names and associated logon names that have access to remote computers. When issuing rcp, rexec, or rsh commands to a remote computer with a properly configured .rhosts file, you do not need to provide logon and password information for the remote computer.

The .rhosts file is a text file where each line is an entry. An entry consists of the local computer name, the local user name, and any comments about the entry. Each entry is separated by a tab or space, and comments begin with a hash mark (#), for example:


computer5 marie #This computer is in room 31A

The .rhosts file must be in the user's home directory on the remote computer. For further information about a remote computer's specific implementation of the .rhosts file, see the remote computer's documentation. (Normally a DNS name server is used instead of the .rhosts file.)