Executes the specified command at the remote host or logs into the remote host.
{ rsh | remsh } RemoteHost [ -a ] [ -n ] [ -l User ] [ -f | -F ] [ -k realm ] [ Command ]
The /usr/bin/rsh command executes the command specified by the Command parameter at the remote host specified by the RemoteHost parameter; if the Command parameter is not specified, the rsh command logs into the remote host specified by the RemoteHost parameter. The rsh command sends standard input from the local command line to the remote command and receives standard output and standard error from the remote command.
If you do not specify the -l flag, the local user name is used at the remote host. If -l User is entered, the specified user name is used at the remote host.
The remote host allows access only if at least one of the following conditions is satisfied:
Although you can set any permissions for the $HOME/.rhosts file, it is recommended that the permissions of the .rhosts file be set to 600 (read and write by owner only).
In addition to the preceding conditions, the rsh command also allows access to the remote host if the remote user account does not have a password defined. However, for security reasons, use of a password on all user accounts is recommended.
The remote host allows access only if all of the following conditions are satisfied:
While the remote command is executing, pressing the Interrupt, Terminate, or Quit key sequences sends the corresponding signal to the remote process. However, pressing the Stop key sequence stops only the local process. Usually, when the remote command terminates, the local rsh process terminates.
To have shell metacharacters interpreted on the remote host, place the metacharacters inside " " (double quotes). Otherwise, the metacharacters are interpreted by the local shell.
When using the rsh command, you can create a link to a path (to which you have permission to write), using a host name specified by the HostName parameter as the link name. For example:
ln -s /usr/bin/rsh HostName
Having established this link, you can specify the HostName parameter and a command specified by the Command parameter from the command line, and the rsh command remotely executes the command on the remote host. The syntax is:
HostName Command
For example, if you are linked to remote host opus and want to perform the date command, enter:
opus date
Because you can not specify the -l User flag, the remote command is successful only if the local user has a user account on the remote host. Otherwise, the rsh command returns a Login incorrect error message. When you specify the HostName parameter without a command, the rsh command calls the rlogin command, which logs you into the remote host. Again, for successful login, the local user must have a user account on the remote host.
The remote host allows access only if at least one of the following conditions is satisfied:
For security reasons, any $HOME/.klogin file must be owned by the remote user and only the AIX owner id should have read and write access (permissions = 600) to .klogin.
This command returns the following exit values:
0 | Successful completion. |
>0 | An error occurred. |
In the following examples, the local host, host1, is listed in the /etc/hosts.equiv file at the remote host, host2.
rsh host2 df
The amount of free disk space on host2 is displayed on the local system.
rsh host2 cat test1 ">>" test2
The file test1 is appended to test2 on remote host host2.
rsh host2 cat test2 >> test3
The remote file test2 on host2 is appended to the local file test3.
/usr/lpp/ssp/rcmd/bin/rsh r05n07 'export KRBTKTFILE=/tmp/rcmdtkt$$; \ /usr/lpp/ssp/rcmd/bin/rcmdtgt; \ /usr/lpp/ssp/rcmd/bin/rcp /tmp/stuff r05n05:/tmp/stuff;'The root user sets the KRBTKTFILE environment variable to the name of a temporary ticket-cache file and then obtains a service ticket by issuing the rcmdtgt command. The rcp uses the service ticket to authenticate from host r05n07 to host r05n05.
$HOME/.klogin | Specifies remote users that can use a local user account. |
/usr/lpp/ssp/rcmd/bin/rsh | Link to AIX Secure /usr/bin/rsh that calls the SP Kerberos 4 rsh routine if applicable. |
/usr/lpp/ssp/rcmd/bin/remsh | Link to AIX Secure /usr/bin/rsh that calls the SP Kerberos 4 rsh routine if applicable. |
Refer to the chapter on security in IBM Parallel System Support Programs for AIX: Administration Guide for an overview. You can access this publication at the following Web site: http://www.rs6000.ibm.com/resource/aix_resource
Refer to the "RS/6000 SP Files and Other Technical Information" section of IBM Parallel System Support Programs for AIX: Command and Technical Reference for additional Kerberos information. You can access this publication at the following Web site: http://www.rs6000.ibm.com/resource/aix_resource
The ftp command, rcp command, rexec command, rlogin command, telnet, tn, or tn3270 command.
SP Commands: k4init, k4list, k4destroy, lsauthpar, chauthpar, Kerberos
Environment variable: KRBTKFILE
The kvalid_user function.
The hosts.equiv file format, .rhosts file format.
Network Overview in AIX 5L Version 5.2 System Management Guide: Communications and Networks.
Secure Rcmds in AIX 5L Version 5.2 System User's Guide: Communications and Networks.