Enabling the execution of remote commands (Linux and UNIX)

You must update your .rhosts file to execute remote commands using rsh.

Before you begin

In a partitioned database system, each database partition server must have the authority to perform remote commands on all the other database partition servers participating in an instance. This authority can be granted by updating the.rhosts file in the home directory for the instance. Because the home directory for the instance is on the shared Db2® home file system, only one .rhosts file is required.

  • You must have root user authority.
  • You must know the host name of each participating computer.
  • You must know the instance owner's user name.

About this task

This topic describes how to enable execution of remote commands using rsh.

You can also use ssh to enable execution of remote commands. To use ssh without being prompted for passwords or pass phrases, refer to:

Procedure

To update your .rhosts file to execute remote commands using rsh:

  1. Log onto the primary computer as a user with root user authority.
  2. Create a .rhosts file in the instance home directory.
    For example, if your instance home directory is /db2home/db2inst1, you can use a text editor to create the .rhosts file by entering the following command:
    vi /db2home/db2inst1/.rhosts
  3. Add entries to the .rhosts file for each computer including the primary computer.
    The .rhosts file has the following format:
    hostname   instance_owner_user_name

    Some systems might require a long host name to be specified, for example: ServerA.yourdomain.com. Before you add host name entries to the .rhosts file, make sure the host names in the /etc/hosts and the /etc/resolv.conf files can be resolved.

    The INSTHOME/.rhosts file should contain entries similar to the following:
    ServerA.yourdomain.com db2inst1
    ServerB.yourdomain.com db2inst1
    ServerC.yourdomain.com db2inst1
    ServerD.yourdomain.com db2inst1
    Rather than specifying each host name individually, you can specify the following entry in the .rhosts file, but this action may pose a security risk and should only be done in a test environment.
    + db2inst1
    If you have specified a high speed switch (netname) in the db2nodes.cfg file, you should also add netname entries for each computer to the .rhosts file. The netname values are specified in the fourth column of the db2nodes.cfg file. A .rhosts file with high speed switch (netname) entries may look similar to the following:
    ServerA.yourdomain.com db2inst1
    ServerB.yourdomain.com db2inst1
    ServerC.yourdomain.com db2inst1
    ServerD.yourdomain.com db2inst1
    Switch1.yourdomain.com db2inst1
    Switch2.yourdomain.com db2inst1
    Switch3.yourdomain.com db2inst1
    Switch4.yourdomain.com db2inst1

What to do next

An alternative to using a .rhosts file is to use /etc/hosts.equiv file. The /etc/hosts.equiv file would contain the exact same entries as the .rhosts file, but must be created on each computer.

For more information about the .rhosts file or the /etc/hosts.equiv file, see your operating system documentation.