Winsock RSH Version 1.6 Copyright 1994 Denicomp Systems All rights reserved DESCRIPTION ----------- Winsock RSH executes a command on a remote host and displays the results on your PC's screen or stores the output in a file. It is similar to the Unix utility of the same name. Winsock RSH differs from Winsock REXEC in that Winsock RSH does not require a password. It depends on "host equivalence", which is explained later in the section on Security. The remote host must be a system running the rshd server process, such a Unix system or another PC running Denicomp Systems' Winsock RSHD, Winsock RSHD/95, or Winsock RSHD/NT. Any output from the remote command will be displayed in the Winsock RSH window. The output includes both the standard output and the standard error output of the command executed. This can be redirected to a file using the -r or -t option. IMPORTANT! You cannot use Winsock RSH to execute an interactive remote command. If you need to execute an interactive command on the remote host, you must use a utility like Telnet. REQUIREMENTS ------------ Winsock RSH requires a PC running Windows 3.1 or higher and a Windows Sockets compatible TCP/IP stack. SYNTAX ------ rsh [-l User] [-m | -h] [-w] [-r File | -t File] Host { Command | @File } * Note: The Host parameter can appear either before or after the flags. PARAMETERS ---------- Host The host name of the remote host on which the command is to be executed. Command The command to execute. If the command contains special characters that are interpreted by a command shell, you must enclose the command inside double quotes (" "). NOTE: Winsock RSH will not expand wildcard characters to match filenames on the local PC, so these do not need to be enclosed in quotes. @File Instead of specifying the Command on the command line, you can store the command to execute in a file. If this parameter begins with the at-sign (@), the command is read from the filename following it. (Do not put any spaces between the @ and the filename.) Since the length of the MS-DOS command line is limited, you can specify longer commands (up to 2048 characters, assuming the remote host allows commands this long) by storing them in a file. FLAGS ----- -l User Specifies that Winsock RSH should log in to the remote host as the user specified by the User variable instead of the local user name. If this flag is not specified, the local and remote user names are the same. -r File Redirects any output from Winsock RSH to File instead of displaying it on the screen. -t File Redirects any output from Winsock RSH to File AND displays the output on the screen. -m Run Minimized. Normally, Winsock RSH will display a window showing the output of the command executed and any possible error messages. With -m, Winsock RSH will only display a minimized icon while running. This is useful for software developers who wish to transparently call Winsock RSH from within their software. -h Run Hidden. Like -m, but will completely hide the Winsock RSH window. Use with caution, since you cannot access hidden windows from the Windows Program Manager using the Task Manager, so it cannot be used to manually stop a command from executing. -w Wait for the Return key after the command completes. This allows you to see the output of the command before the window is closed when the command completes. It will display "Press Return:" and wait for you to press Return. Before pressing Return, you can use the scrollbars to review any scrolled lines. If you do not specify the -l flag, the local user name is used at the remote host. If -l User is entered, that user name is used at the remote host. The local user name is determined by first looking in the file WIN.INI in the Windows directory. If this file contains a section named "[RSH]" and contains an entry named "User" in that section, the name specified there will be used as the local user name. For example, WIN.INI would contain: [RSH] User=joe If this appeared in WIN.INI, the local user name would be "joe" and Winsock RSH would use this name at the remote host. If this section does not appear in WIN.INI, Winsock RSH uses the Computer Name specified in the Windows for Workgroups Network Setup (found on the Control Panel). This name is converted to lowercase characters and Winsock RSH uses this name at the remote host. Therefore, if no user name is specified in WIN.INI, the Computer Name of the PC must be set up as a valid user on the remote host, in addition to being included in the remote host's /etc/hosts.equiv file. (If you are not using Windows for Workgroups and your network does not provide the services that Windows for Workgroups provides, you must use WIN.INI to specify the user name.) SECURITY -------- Security is enforced by the remote system, not by Winsock RSH. If the remote host is a Unix system, the name and IP address of the PC must appear in the /etc/hosts file. Also, at least one of the following conditions must be satisfied: * The name of the PC as it appears in /etc/hosts is listed as an equivalent host in the /etc/hosts.equiv file on the remote host. * If the local host is not in the /etc/hosts.equiv file, the user's home directory on the remote host must contain a .rhosts file that lists the name of the PC (see "man rhosts" for more information on the format of the .rhosts file). Also, the .rhosts file MUST be owned by the user or by root, and MUST have permissions of 0600. * The user's login on the remote host does not require a password. ADDITIONAL OPTIONS ------------------ There are two options you can specify in the [RSH] section WIN.INI to control the behavior of Winsock RSH. The Minimize entry allows you to control the display of the Winsock RSH window without using the -m or -h command line options. This is useful if you have third party software that calls Winsock RSH and you cannot modify it to run Winsock RSH minimized or hidden through command line options. If you set Minimize to a value of 1 in WIN.INI, Winsock RSH will always run minimized. If you set Minimize to a value of 2, Winsock RSH will always run hidden. For example, to always run Winsock RSH minimized, specify in WIN.INI: [RSH] User=joe Minimize=1 If either the -m or -h options are specified on the command line, these will override the option specified in WIN.INI. However, there is no way to cause Winsock RSH to run with a normal window if the Minimize option is specified in WIN.INI. The other option available is the BufSize entry. This specifies the number of characters that will be read from the network connection at one time and displayed on the screen. By default, this is set to a value of 512 characters. Normally, you do not need to change this option. If you set it too high, you will receive "out of memory" errors from Winsock RSH. Setting it to a low value, such as 1, will cause Winsock RSH to display information from the remote host more slowly. If this is desired, try setting BufSize to 1. EXAMPLES -------- * To display the users logged in to a remote host, use: rsh remhost who The list of users is displayed in the RSH window on your PC. As you see, the window is closed when the command ends, so this command is not very useful. Try this: rsh -w remhost who This will list the users on the remote host, then wait for you to press the Return key before closing the window. If the list of users scrolled the window, you can use the scrollbars to view the scrolled information. * To list the files in the /usr directory ending with .txt on the remote host, use: rsh -w remhost ls /usr/*.txt The files in the /usr directory are displayed in the Winsock RSH window. Again, the -w option is used to wait for the Return key so you can see the results. * This lists the contents of the /usr directory on the remote host and stores it in the file "usrfiles.txt" on your PC. We will run the command minimized so the RSH window does not display: rsh -m -r \lists\usrfiles.txt remhost ls /usr The file "usrfiles.txt" will contain the list of files in /usr. SUPPORT ------- Support is available via U.S. Mail and Compuserve/Internet. Denicomp Systems P.O. Box 731 Exton, PA 19341 Compuserve: 71612,2333 Internet: 71612.2333@compuserve.com