Simple Steps for Setting Up Private/Public Key Authentication Using DSA

Simple & Quick Steps for Setting Up Private/Public Key Authentication Using DSA:

First Scenario: Host Server & Client Machine both running Linux distro

  1. It assumes that you have ssh-keygen installed on your machine. If not, go & grab the appropriate RPM from
  2. Go to  ~/.ssh/ in your console and use the following command

    ssh-keygen -t dsa -b 1024

    You should see something like this:

    Generating public/private dsa key pair.
    Enter file in which to save the key (/home/username/.ssh/id_dsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/username/.ssh/id_dsa.
    Your public key has been saved in /home/username/.ssh/
    The key fingerprint is:

  3. Login to the Host server & do the same stuff
  4. Now Copy the from Server to you local machine using SCP or SFTP
  5. Cat the from server to authorized_keys2 under .ssh like

    cat ../ >> authorized_keys2

  6. Change the permissions on file like

    chmod 700 authorized_keys2

  7. Now you can use ssh-copy-id command directly for copying the local machine key to authorized_key2 on host server like


    If that’s complicated for you then follow the same steps 4-6

  8. You are done :); Restart the shell you should able to login on host machine without using the password