## TCPware V5.7 User's Guide

- Introduction

Chapter 9

RSH: Issuing Commands on a Remote Host

# Introduction

RSH is the Berkeley R Command utility you can use to execute a single command on a remote host without logging in.

This chapter is a summary of using the RSH command.

Before you use RSH, make sure your host and/or username is registered in the remote system's ~/.rhosts file (if UNIX) or SYS$LOGIN:.RHOSTS file (if OpenVMS)

See the Management Guide, Chapter 16, Managing R Commands, for details on host equivalence files.

To use Kerberos version 4 authentication with the remote host, make sure that your username and Kerberos realm are in the remote host's ~/.klogin file (if UNIX) or SYS$LOGIN:.KLOGIN file (if OpenVMS).

To use Kerberos v4 authentication, your system manager must configure TCPware's Kerberos Services. You must also first get a ticket-granting ticket (TGT) from the Kerberos Server.

See Chapter 4, Kerberos User Commands, for details on getting a TGT.

If you request Kerberos authentication, TCPware tests for it first. If the test fails, standard authentication is used instead.

With Kerberos v4 authentication, you can specify the Kerberos realm using the /REALM qualifier. If omitted, the TCPWARE_KERBV4_REALM logical value determines the realm.

RSH

Executes a single command on a remote host. The remote host must provide command execution service.

When the command completes execution on the remote host, the RSH command exits and closes the connection; you return to your local working environment.

RSH writes any output from the command to SYS$OUTPUT; it writes any error from the command to SYS$ERROR, unless overridden with the /OUTPUT or /ERROR qualifier.

Some servers (such as UNIX servers) send output with only line feeds for screen display. To satisfy OpenVMS screen displays, RSH inserts a carriage return by default before each line feed before sending the output to the terminal. If your screen display requires only a line feed, use the /RAW qualifier to bypass the default.

If you need to preserve case for any of the command elements, enclose each in quotes, since RSH lowercases unquoted text strings. Include a pair of quotes for each redirection of the command. If you are redirecting a command through one remote host to have it executed on a third, each host in turn strips off a pair of quotes after interpreting the command. In this case, you may need three pairs of quotes around the command element in order to preserve case.

Format

RSH host command

Parameters

host

Name or internet address of the host you want to execute the command on. Can be a domain-style name or an IP address.

command

Name of the command or command string to execute on the remote host.

Qualifiers

/AUTHENTICATION[=auth-type]

Determines the authentication method. If auth-type is KERBV4 (or you omit the value), Kerberos v4 authentication is used. If auth-type is NULL (or you omit the qualifier), standard authentication is used.

/ERROR=file

File or device to which to direct error messages from the remote command. The default is
/ERROR=SYS$ERROR. (See also the /SYSERROR qualifier.)

/LOG=file

Logs a copy of the output to the specified file. Output continues to be directed to SYS$OUTPUT while it is being recorded in the log file. Not valid with /SYSERROR. The default is no logging.

/OUTPUT=file

Output file or device to which to direct output from the command. The default is /OUTPUT=SYS$OUTPUT.

/PASSWORD=remote-password

Password for the remote account. Use together with the /USER qualifier. The password is sent across the network as plain text.

/RAW
/NORAW (default)

Prevents an extra carriage return from being inserted for screen display. Specifying /NORAW or omitting the qualifier places a carriage return before a line feed character before the line is written to the terminal.

/REALM=realm

Assigns the name of the Kerberos realm. Use if the Kerberos Server resides in a different realm than the local host. Use with the /AUTHENTICATION=KERBV4 qualifier and value. Realm is converted to lowercase unless you enclose it in quotes.

If omitted, the Kerberos realm is determined by the TCPWARE_KERBV4_REALM logical value.

/SYSERROR

Same as the /ERROR qualifier except that it sends messages to the NLA0 device.

/TRUNCATE[=n]

Truncates the local OpenVMS username to the specified n length. The n value must be greater than zero or the command aborts with an error. The default is eight characters.

If the local username is also the remote username (if you omit the /USER qualifier), TCPware also truncates the remote username to the indicated length. However, it never truncates a remote username specified explicitly with the /USER qualifier.

/USER=remote-username

Remote host's username that is different from the username with which you are currently logged in to the local host. TCPware never truncates an explicitly specified remote username (see the /TRUNCATE qualifier). Remote-username is converted to lowercase unless you enclose it in quotes.

Examples

1 This command opens a connection to host IRIS and displays the name of your current working directory:

rsh iris pwd

2 This command opens a connection to host IRIS for username "Smith" and displays the name of the working directory for "Smith":

rsh iris /user="Smith" pwd

The quotes around Smith are necessary because the name contains a mixture of upper- and lowercase characters that you would want to preserve in sending the command. Without the quotes, the name converts to lowercase and may not match the username on the remote host.

3 This command opens a connection to host IRIS and displays the name of your working directory in a "raw" state on a terminal that requires only line feeds to display the information:

rsh iris /raw pwd

4 This command executes a pwd command on ROSES as sent through VIOLET.

$ rsh violet /user=system /password=plastic -
_$ rsh roses /user=root/password="""TCPware""" pwd

The TCPware password is triple-quoted to preserve case through the transaction. The system strips off the first pair of quotes and executes rsh roses /user=root/pass=""TCPware"". VIOLET strips off the second set of quotes and executes rsh roses /user=root/pass="TCPware". ROSES strips off the third and executes pwd. In each case, the password string is interpreted literally.

5 This command uses Kerberos version 4 authentication to open a connection to remote host IRIS. The Kerberos Server resides in the daisy.com realm. Also displays the name of your current working directory.

rsh /auth=kerbv4 /realm=daisy.com iris pwd

6 This command uses Kerberos version 4 authentication to open a connection to remote host IRIS and displays the name of your current working directory. Because /REALM is omitted, the TCPWARE_KERBV4_REALM logical value determines the Kerberos realm.

rsh /auth iris pwd