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
-
It assumes that you have ssh-keygen installed on your machine. If not, go & grab the appropriate RPM from http://rpmfind.net/linux/rpm2html/search.php?query=%2Fusr%2Fbin%2Fssh-keygen
-
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/id_dsa.pub.
The key fingerprint is:
bla…blahh… - Login to the Host server & do the same stuff
- Now Copy the id_dsa.pub from Server to you local machine using SCP or SFTP
- Cat the id_dsa.pub from server to authorized_keys2 under .ssh like
cat ../id_dsa.pub >> authorized_keys2
- Change the permissions on file like
chmod 700 authorized_keys2
- Now you can use ssh-copy-id command directly for copying the local machine id_dsa.pub key to authorized_key2 on host server like
ssh-copy-id accountname@remotehost.com
If that’s complicated for you then follow the same steps 4-6
- You are done :); Restart the shell you should able to login on host machine without using the password