Winsock REXEC Version 1.6 Copyright 1995 Denicomp Systems All rights reserved DESCRIPTION ----------- Winsock REXEC 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 REXEC differs from Winsock RSH in that it requires you to supply a password. The command will not be executed unless you supply the correct password. The password can be typed at the keyboard when you execute the command or you can include it in the REXEC command line or store it in the Windows WIN.INI file. The remote host must be a system running the rexecd server process (i.e. a Unix system). Currently, Denicomp Systems' Winsock RSHD does not provide the rexecd service, although this may be added in the future. Any output from the remote command will be displayed in the Winsock REXEC 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 REXEC 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 REXEC requires a PC running Windows 3.1 or higher and a Windows Sockets compatible TCP/IP stack. SYNTAX ------ rexec [ -l User ] [-p Password [-m | -h] [-w] [-r File | -t File ] Host { Command | @File } * Note: The Host parameter may 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 REXEC 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 REXEC 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. -p Password Specifies the password to be sent to the remote host. If you do not use this option and the password is not specified in WIN.INI, you will have to enter the password before the command executes. -r File Redirects any output from Winsock REXEC to the File instead of displaying it on the screen. -t File Redirects any output from Winsock REXEC to the File AND also displays it on the screen. -m Run Minimized. Normally, Winsock REXEC will display a window showing the output of the command executed and any possible error messages. With -m, Winsock REXEC will only display a minimized icon while running. This is useful for software developers who wish to transparently call Winsock REXEC from within their software. -h Run Hidden. Similar to the -m option, but hides the Winsock REXEC window entirely. Use with care; you cannot access hidden applications from the Windows Program Manager using the Task Manager, so you cannot manually stop the 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 specified, 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 "[REXEC]" 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: [REXEC] User=joe If this appeared in WIN.INI, the local user name would be "joe" and Winsock REXEC would use this name at the remote host. If the "[REXEC]" section does not appear in WIN.INI, it then looks at the section named "[RSH]" for the "User" entry and uses that name if it is found. This is done so that you only need to specify the user name once if you use both the Winsock RSH and Winsock REXEC utilities. If neither section appears in WIN.INI, Winsock REXEC 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 REXEC 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. (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.) Additionally, you may store your password in the WIN.INI file if you wish. If Winsock REXEC finds a "Password" entry in the "[REXEC]" section of WIN.INI, it will use the password specified on that line instead of asking you to type the password. For example: [REXEC] User=joe Password=Denicomp When Winsock REXEC is used in this example and no -l or -p options are specified on the command line, the user name "joe" is used with a password of "Denicomp". If you use the -l option to specify another user name or the -p option to specify a password on the command line, the Password entry will NOT be used. If you only specify the -l option, you will have to enter the password before the command is executed. Keep in mind the security problems in storing the password in the WIN.INI file, since it is not encrpyted. Also note that if you are going to use the "Password" entry, it MUST appear in the same section as the "User" entry. If you are using the "[RSH]" section to store the user name for both Winsock REXEC and Winsock RSH, you must put the "Password" entry in that section also. SECURITY -------- The remote host allows access only if you specify a valid user name and password. The /etc/hosts.equiv and .rhosts files, used by RSH to enforce security, are not used by REXEC. ADDTIONAL OPTIONS ----------------- There are two options you can specify in the [REXEC] section WIN.INI to control the behavior of Winsock REXEC. Please note that these must appear in the [REXEC] section, not [RSH]. The Minimize entry allows you to control the display of the Winsock REXEC window without using the -m or -h command line options. This is useful if you have third party software that calls Winsock REXEC and you cannot modify it to run Winsock REXEC minimized or hidden through command line options. If you set Minimize to a value of 1 in WIN.INI, Winsock REXEC will always run minimized. If you set Minimize to a value of 2, Winsock REXEC will always run hidden. For example, to always run Winsock REXEC minimized, specify in WIN.INI: [REXEC] User=joe Password=Denicomp 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 REXEC 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 REXEC. Setting it to a low value, such as 1, will cause Winsock REXEC 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: rexec remhost who This will first ask you for your password if it is not stored in WIN.INI. The list of users is then displayed in the REXEC window on your PC. As you see, the window is closed when the command ends, so this command is not very useful. Try this: rexec -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: rexec -l bob -p xyzxyz -w remhost ls /usr/*.txt The files in the /usr directory are displayed in the Winsock REXEC window. Again, the -w option is used to wait for the Return key so you can see the results. Also, the user is specified with the -l flag and the password is specified after the -p flag, so Winsock REXEC will not ask you to type it in before the command executes. * 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 REXEC window does not display: rexec -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