rexec Command

Purpose

Executes commands one at a time on a remote host.

Syntax

rexec [ -a ][ -d | -n ] [ -i ] Host Command

Description

The /usr/bin/rexec command executes a command on the specified remote host.

The rexec command provides an automatic login feature by checking for a $HOME/.netrc file that contains the user name and password to use at the remote host. If such an entry is not found or if your system is operating in secure mode (see the securetcpip command), the rexec command prompts for a valid user name and password for the remote host. In both cases, rexec causes rexecd on the remote system to use the default compat login authentication method for the user. rexecd does not look at the /etc/security/user file on the remote system for alternative authentication methods. You can also override the automatic login feature by specifying the -n flag on the rexec command line.

Restriction: Any user with a user ID less than or equal to 128 cannot log in to the remote Trusted AIX® system.

Flags

Item Description
-a Indicates the standard error of the remote command is the same as standard output. No provision is made for sending arbitrary signals to the remote process.
-d Enables socket-level debugging.
-i Prevents reading the stdin.
-n Prevents automatic login. With the -n flag specified, the rexec command prompts for a user name and password to use at the remote host, rather than searching for a $HOME/.netrc file.

Parameters

Item Description
Command Specifies the command, including any flags or parameters, to be executed on the remote host.
Host Specifies in alphanumeric form the name of the host where the command is to be executed.

Examples

  1. To execute the date command on a remote host, enter:
    rexec host1 date
    The output from the date command is now displayed on the local system. In this example, the $HOME/.netrc file on the local host contains a user name and password valid at the remote host.

    If you do not have a valid entry in the $HOME/.netrc file for the remote host, you will be prompted for your login ID and password. After you have entered the requested login information, the output from the date command is displayed on the local system.

  2. To override the automatic login feature and execute the date command on a remote host, enter:

    rexec -nhost1 date

    Enter your name and password when prompted.

    The output from the date command is now displayed on the local system.

  3. To list the directory of another user on a remote host, enter:
    rexec host1 ls -l /home/karen
    The directory listing of user karen on remote host host1 is displayed on the local system.

    If you do not have a valid entry in the $HOME/.netrc file for the remote host, you will be prompted for your login ID and password. After you have entered the requested login information, the directory listing of user karen on remote host host1 is displayed on the local system.