Friday, December 30, 2011

Howto Add SSH Key to list of Authorized Keys

This little Guide tell you how to Put a New Entry between the Authorized Keys List.

  1. Generate the SSH Keys:

    How-to Generate a SSH Key
  2. To Upload the Key to the Server you need the ssh Access Password that usually is the Same as the ccpanel one.

  3. After on Unix like Systems you can use rsync to Upload it with:

    rsync -av -e "ssh -p PORT-NUMBER" ~/.ssh/id_dsa.pub \
    USERNAME@SERVER-ADDRESS:~/ 

    You need to Substitute PORT-NUMBER, USERNAME and SERVER-ADDRESS with your Hosting Parameters.

  4. Now you have the Key to Add in the Server Home Directory and you can procede to Login into Remote:

    ssh -p PORT-NUMBER USERNAME@SERVER-ADDRESS

    Normaly now you will be Prompt for the Password to get Access.

  5. Then to Copy the Key into the Authorized List:

    cat id_dsa.pub >> .ssh/authorized_keys
  6. Last you can check than you haven't any blank line inserted into the ssh Keys Stack with:

    cat .ssh/authorized_keys
  7. After is Time to Test your Newly Authorized Access with:

    Close the SSH Session with:
    logout
    Login Again:
    ssh -p PORT-NUMBER USERNAME@SERVER-ADDRESS

    And like a Charm you should Get Direct Access into the Server.