Configure Passwordless SSH for SLX-OS Releases earlier than 20.2.3

You can configure passwordless SSH for SLX-OS.

About this task

Follow this procedure to configure passwordless SSH for SLX-OS releases earlier than 20.2.3.

Procedure

Run the ssh-keygen and ssh-copy-id commands on each TPVM to configure the SSH passwordless login. For example, SSH or console into TPVM1 as an admin user and complete the following steps:
  1. On TPVM1 and TPVM2, run the following command:
    ```bash
    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 TPVM1, paste the contents of the .pub file from TPVM2 into the /root/.ssh/authorized_keys file.
  3. On TPVM2, paste the contents of the .pub file from TPVM1 into the /root/.ssh/authorized_keys file.
  4. Verify that the root from each TPVM can SSH into the root of the other TPVM with no password prompt.
  5. (Optional) On a Linux server, use the following script and pass the IP address of TPVM1 and TPVM2 as separate arguments:
    You will be prompted for a password of each TPVM as it bootstraps.
    ```bash
    #!/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`
    TPVM1_IP="$1"
    TPVM2_IP="$2"
    TPVM_USER="extreme"
    SSH_OPTION="-o StrictHostKeyChecking=no"
    echo "Setting up passwordless ssh login from this host to TPVMs..."
    ssh-copy-id $MY_PUB_KEY $SSH_OPTION $TPVM_USER@$TPVM1_IP
    ssh-copy-id $MY_PUB_KEY $SSH_OPTION $TPVM_USER@$TPVM2_IP
    echo "Generating ssh keypairs for root on TPVMs..."
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM1_IP "sudo mkdir -p /root/.ssh"
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM2_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 $TPVM_USER@$TPVM1_IP "sudo ssh-keygen -b 4096 -t rsa -q -N '' -f /root/.ssh/id_rsa"
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM2_IP "sudo ssh-keygen -b 4096 -t rsa -q -N '' -f /root/.ssh/id_rsa"
    echo "Setting up passwordless ssh login between TPVMs..."
    TPVM1_ROOT_PUB_KEY=`ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM1_IP "sudo cat /root/.ssh/id_rsa.pub"`
    TPVM2_ROOT_PUB_KEY=`ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM2_IP "sudo cat /root/.ssh/id_rsa.pub"`
    echo "Exchanging ssh public keys for root between TPVMs..."
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM1_IP "echo $TPVM2_ROOT_PUB_KEY | sudo tee -a /root/.ssh/authorized_keys"
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM1_IP "echo $TPVM1_ROOT_PUB_KEY | sudo tee -a /root/.ssh/authorized_keys"
    echo "Adding TPVM IPs for root between TPVMs as known hosts to skip first time login prompts..."
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM1_IP "sudo ssh-keyscan -H $TPVM2_IP >> /root/.ssh/known_hosts"
    ssh ${MY_PUB_KEY::-4} $SSH_OPTION $TPVM_USER@$TPVM2_IP "sudo ssh-keyscan -H $TPVM1_IP >> /root/.ssh/known_hosts"
    echo "Completed passwordless ssh login between TPVMs."
    ```