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.

Tell me the steps

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:

$ scp id_rsa.pub scanner@test.mycompany.com:.

2) Enter your user account password when prompted.

3) Login to each target host as the user created for the purpose of authentication.

4) Enter your user account password when prompted.

5) Enter the following commands:

$ 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--