Example 2-10 Accept the authentication key the first time accessing a machine using ssh

$ ssh root@baltic

The authenticity of host 'baltic (9.43.86.48)' can't be established. RSA key fingerprint is 48:56:a4:d9:27:25:12:0f:b3:11:5a:60:52:7a:25:e0. Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'baltic,9.43.86.48' (RSA) to the list of known hosts.

root@baltic's password:

Enabling SSH automatic login for root user

In addition to the authentication key that has to be accepted during the first ssh connection, you have to provide a user password each time you log in. To make our mass deployment script accessible across various machines without being prompted to accept an authentication key or to specify a password, we can set up an automatic ssh login.

Because the deployment scenario we demonstrate in this section is performed using a root ID, we have to enable the automatic login for the root user. The machine where we initiate the deployment is Zaire. So the root user on Zaire requires sufficient privileges to send commands to other machines, including Baltic and Banda, where the DB2 server is to be deployed. So we must enable automatic login on them.

The procedure to enable SSH automatic login on a remote machine is as follows:

1.Login to the file server machine as a root user from where the deployment command will be executed. In our case, the machine is Zaire. Under the root user’s home directory, create a subdirectory .ssh if it does not already exist. The public and private key files will be saved in it. Example 2-11shows the commands.

Do the same thing on every remote machine.

Example 2-11 Create subdirectory and grant correct permission

#mkdir -p ~/.ssh

#chmod 700 ~/.ssh

2.Generate a private and public key pair from the command line. See Example 2-12.

Example 2-12 Generate a public and private key pair using DSA

#cd ~/.ssh

#ssh-keygen -t dsa -f ~/.ssh/id_dsa -N ""

60DB2 Deployment Guide

Page 74
Image 74
IBM manual Enabling SSH automatic login for root user, 60 DB2 Deployment Guide