Configure Passwordless SSH

You can configure passwordless SSH for both the nodes in XCO.

About this task

Follow this procedure to configure the passwordless SSH between the root users of both nodes prior to installation.

Procedure

  1. Run the ssh-keygen and ssh-copy-id commands on each node to configure the SSH passwordless login. For example, SSH or console into the nodes as an admin user, then run the following commands:
    sudo sed -i "s/#PermitRootLogin\ prohibit-password/PermitRootLogin\ prohibit-password/g" /etc/ssh/sshd_config
    sudo mkdir -p /root/.ssh
    sudo ssh-keygen -b 4096 -t rsa -q -N '' -f /root/.ssh/id_rsa
    sudo cat /root/.ssh/id_rsa.pub
  2. On Node1, paste the contents of the .pub file from Node2 into /root/.ssh/authorized_keys directory. On Node2, paste the contents of the .pub file from Node1 into /root/.ssh/authorized_keys directory.
  3. Verify that the root from each node can SSH to the root of the other node with no password prompt.
  4. Run the following script and pass the IP address of Node1 and Node2 as separate arguments:
    You will be prompted for the password of each node after it bootstraps.
    Note

    Note

    Modify the script to suit your requirements.
    #!/bin/bash
    # Change this to the reference the appropriate local host public key for non-TPVM Linux.
    MY_PUB_KEY=`-i ~/.ssh/id_rsa.pub`
    NODE1_IP="$1"
    NODE2_IP="$2"
    NODE_USER="extreme"
    SSH_OPTION="-o StrictHostKeyChecking=no"
    echo "Setting up passwordless ssh login from this host to nodes..."
    ssh-copy-id $MY_PUB_KEY $SSH_OPTION $NODE_USER@$NODE1_IP
    ssh-copy-id $MY_PUB_KEY $SSH_OPTION $NODE_USER@$NODE2_IP
    echo "Generating ssh keypairs for root on nodes..."
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE1_IP "sudo mkdir -p /root/.ssh"
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE2_IP "sudo mkdir -p /root/.ssh"
    # Please note that you can change the key type, bits, and filename here, but the -N '' should be left alone.
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE1_IP "sudo ssh-keygen -b 4096 -t rsa -q -N '' -f /root/.ssh/id_rsa"
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE2_IP "sudo ssh-keygen -b 4096 -t rsa -q -N '' -f /root/.ssh/id_rsa"
    echo "Setting up passwordless ssh login between nodes..."
    NODE1_ROOT_PUB_KEY=`ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE1_IP "sudo cat /root/.ssh/id_rsa.pub"`
    NODE2_ROOT_PUB_KEY=`ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE2_IP "sudo cat /root/.ssh/id_rsa.pub"`
    echo "Exchanging ssh public keys for root between nodes..."
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE1_IP "echo $NODE2_ROOT_PUB_KEY | sudo tee -a /root/.ssh/authorized_keys"
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE1_IP "echo $NODE1_ROOT_PUB_KEY | sudo tee -a /root/.ssh/authorized_keys"
    echo "Adding node IPs for root between nodes as known hosts to skip first time login prompts..."
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE1_IP "sudo ssh-keyscan -H $NODE2_IP >> /root/.ssh/known_hosts"
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $NODE_USER@$NODE2_IP "sudo ssh-keyscan -H $NODE1_IP >> /root/.ssh/known_hosts"
    echo "Completed passwordless ssh login between nodes."