Laura Seletos

How to Setup SSH Keys instead of Passwords for Linux Servers

Discussion created by Laura Seletos Employee on Jun 20, 2017
Latest reply on Jan 17, 2018 by J Lartey
Note: Workflow detailed by mwalker

Step 1:
How do I generate an ssh key pair:
Step 2: How do I distribute my Public Key
  • The public key to be used for Unix authentication needs to be installed on each target host to be scanned. Do this by appending the contents of the public key file to the ".ssh/authorized_keys2" file on each target host, in the home directory of the user for whom the key was created.
  • Steps for the process:
    • Step 1: From the system where the key pair was generated, copy the public key to each target host. You can use the SSH secure copy (SCP) program for this by entering the following:
      • $ scp public_key username@targethost:.

      • Where public_key is the name of your public key (for example id_rsa.pub). For example, you might enter:
    • Step 2: Enter your user account password when prompted.
    • Step 3: Login to each target host as the user created for the purpose of authentication.
    • Step 4: Enter your user account password when prompted.
    • Step 5: Enter the following commands:
      • py (SCP) program for this by entering the following:
        • $ mkdir .ssh
          $ chmod 700 .ssh
          $ cat public_key >> .ssh/authorized_keys2
          $ rm public_key
      • Where public_key is the name of your public key (for example id_rsa.pub).  
      • If the "authorized_keys2" file already exists, the contents of the public key will be appended to it. If the "authorized_keys2" file does not already exist, it will be created and the public key will be appended. It's recommended that you check file permissions for "authorized_keys2" to ensure that the file is world-readable and owner-writable.
      • How to verify permissions for "authorized_keys2":
        1. Use the "chmod" utility to set permissions by entering the following command:
          • $ chmod 644 .ssh/authorized_keys2
        2. Verify permissions by entering the following command:
          • $ ls -l .ssh/authorized_keys2
        3. The file permissions should show up as:
          • -rw-r--r--

  • Step 3: How to configure Qualys
    • To be added

Outcomes