First check if you have generated any DSA key in your client side .ssh folder
$ cd ~/.ssh
$ ls -l
If you see any of the file name shown below, then you already have the key, you can skip the next steps (DSA key generation).
id_dsa
id_dsa.pub
Enter the command below to generate the DSA key at the client side
$ ssh-keygen -t dsa
and you will see sth like below. just leave everything blank and press Enter all the way till it end.
Generating public/private dsa key pair.
Enter file in which to save the key (/home/urname/.ssh/id_dsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/urname/.ssh/id_dsa.
Your public key has been saved in /home/urname/.ssh/id_dsa.pub.
The key fingerprint is:
4e:3f:05:78:3f:9e:97:6c:3b:ad:e8:58:37:bd:35:d4 urname@yourmachine
Now transfer your DSA public key from client to the server using the command below:-
$ scp ~/.ssh/id_dsa.pub remoteuser@remotemachine:.ssh/myid_dsa.pub
Now, login to the remote machine and make sure the .ssh folder is at right permission
$ chmod 700 ~/.ssh
At the remote machine, append the myid_dsa.pub to authorized_keys and remove the original key.
$ cat myid_dsa.pub >> ~/.ssh/authorized_keys
$ rm myid_dsa.pub
Now change the permission of authorized_key file at the remote server
$ chmod 600 ~/.ssh/authorized_keys
Configuration done. you may now try to ssh to the remote server. It should not prompt you for any password from now on.
No comments:
Post a Comment