rsh can be used to execute a command on a remote Unix system.
You can use this command if, for example:
you want to determine the contents of a directory on a remote Unix system, or
you want to print a file on the remote Unix system.
The rsh command can only be used by users with access authorization on the remote host. In other words, the .rhosts file in the HOME directory of the user ID on the remote Unix system must have an entry containing the name of the local host or a plus character (+) and the user ID. The user ID must have a standard account number for rlogin access. This standard account number can be assigned using the ADD-USER, MODIFY-USER-ATTRIBUTES or ADD-POSIX-USER command.
The rsh command can be used symmetrically by BS2000-POSIX and remote Unix systems.
The files /etc/hosts and /etc/hosts.equiv usually used in Unix systems are not used in POSIX. The assignment of host names to IP addresses is handled via BCAM or DNS.
The command can only be executed if the daemon rshd is active on the local and remote hosts. The daemon rshd is started by inetd.
The actual command interpreter called to execute the command on the remote host is determined by the entry of the user in the /etc/passwd file.
If rsh is executed from a file that is not named rsh, it will use the name of that file as the remote host. In other words, if you create a symbolic link to rsh under the name of the remote host, you can call rsh by simply specifying that host name.
Stop signals interrupt only the rsh process on the local host.
The environment variables of the local host are not passed to the command interpreter on the remote host.
Syntax
rsh
host[
-n
][
-l
login][
-x
][ kommando][ option]
|
The BCAM or DNS name of the remote host on which a Shell command is executed. The name of the remote host must be known to local BCAM or to the DNS server. Instead of the name of the remote host you can also specify its IP address in IPv4 or IPv6 dot notation. The IP address must be known to BCAM. IPv4: n.n.n.n n = 0..255 (decimal) IPv6: x:x:x:x:x:x:x:x x = 0..FFFF (hexadecimal) The alternative presentation methods described in RFC 2373 are permissible for IPv6 dot notation.
Instructs the rsh command to not redirect its standard input to the command on the remote host. The standard input of rsh is redirected to /dev/null instead. This is useful, for example, if the output of the rsh command is being piped to a program that is itself reading from standard input (see Example 1). Note, however, that -n is also required when an rsh command is started in the background. For example, the call
causes tar to terminate before rsh. The rsh command then tries to write to the broken pipe and competes with the command interpreter for the standard input instead of exiting. The -n option can prevent this from occurring. This problem only occurs when rsh is located at the start of a pipe and is not reading from standard input. If you want rsh to actually read from standard input, you must not specify the -n option. For example, if you call the command
with the -n option, rsh will incorrectly read from /dev/null instead of the pipe.
The user ID (or login name) with which the user has logged on at the remote host. This user ID must be specified if you want to work on the remote host with a different user ID than on the local host.
The rsh command returns the termination status of the remote command if the rsh server on the remote system also supports this feature (BS2000-POSIX, Unix system).
The command to be executed on the remote host. command not specified:
Arguments to be used with the command on the remote host. |
Mode of operation
The rsh command transfers
The interrupt, quit and terminate signals are passed on to the command on the remote host. The current directory of the started command is set to the HOME directory of the user on the remote host. Metacharacters (e.g. <, >, &) that have not been escaped are evaluated on the local host. Escaped metacharacters are interpreted on the remote host. The rsh command exits on completion of the command on the remote host. Screen-oriented programs such as ced, for example, cannot be activated with the rsh command. The command rlogin must be used instead. |
Example 1
The POSIX user john wants to view the contents of the directory /home/john/test on the remote host rainbow. The output is to be displayed on the screen in pages. The user ID john is also present on the remote host rainbow.
|
Example 2
The POSIX user john wants to append the contents of the remote file /home/john/hello_1 on the remote host rainbow to the local file test_1. The user ID john is also present on the remote host rainbow.
|
Example 3
The POSIX user john wants to append the remote file /home/john/travel_1 to the remote file /home/john/holland. Both files are located on the host rainbow. The user ID john is also present on the host rainbow.
|
Example 4
The POSIX user john wants to print the remote file /home/emil/test on the host rainbow at that host.
|
Example 5
A POSIX user wants to print the local file /home/john/dat on the remote host rainbow.
|
File
/$HOME/.rhosts List of host names and user IDs that can log on to the hosts under the listed IDs. |
See also
rcp |