User talk:Znazari
From athena
Instructions on How to Create SSH keys and Use them: Create
1.Use the ssh-keygen command to create your first authentication key. The command looks like this: ssh-keygen -t rsa1
2.The ssh-keygen should respond to this command as the follwoing: Generating public/private rsa1 key pair. Enter file in which to save the key (/Users/dustman/.ssh/identity):
3. Here you have the option of changing the file path. Or you can simply press enter withought changing the path. Then you are prumpted to enter a passphrase: Enter passphrase (empty for no passphrase): Enter same passphrase again:
4.It is recomended to enter a passphrase for security perposes. Once you enter your passphrase, the fingerprint of the key will be shown.
5.In the same manner, create the other two keys:
ssh-keygen -t dsa ssh-keygen -t rsa
6.To see your keys, you need to go to your .ssh directory: zahra@venus:~$ cd .ssh 7.Then you can use the following command to see a list of your keys: zahra@venus:~/.ssh$ ls -la
drwx------ 2 zahra zahra 4096 2007-07-24 09:46 . drwxr-xr-x 33 zahra zahra 4096 2007-07-24 10:22 .. -rw-r--r-- 1 zahra zahra 1630 2007-07-20 16:01 authorized_keys -rw------- 1 zahra zahra 668 2007-07-24 09:46 dsa_test -rw-r--r-- 1 zahra zahra 601 2007-07-24 09:46 dsa_test.pub -rw------- 1 zahra zahra 744 2007-07-24 08:58 id_dsa -rw-r--r-- 1 zahra zahra 601 2007-07-24 08:58 id_dsa.pub -rw------- 1 zahra zahra 974 2007-07-24 08:57 identity -rw-r--r-- 1 zahra zahra 638 2007-07-24 08:57 identity.pub -rw------- 1 zahra zahra 1743 2007-07-24 09:00 id_rsa -rw-r--r-- 1 zahra zahra 393 2007-07-24 09:00 id_rsa.pub -rw-r--r-- 1 zahra zahra 3044 2007-07-24 10:02 known_hosts -rw------- 1 zahra zahra 1675 2007-07-24 09:45 weasel_key -rw-r--r-- 1 zahra zahra 393 2007-07-24 09:45 weasel_key.pub
Now is the time to copy your public keys to server. In order to do this, open each public key on your local machine with vim and copy the key. Then in another terminal, connect to server and open authorized_keys using vim and paste the content of each key there. Then save them and close the terminal and exite from the remote system.
You can also try the following:
zahra@venus:~$ ssh-keygen -U reader no support for smartcards.
zahra@venus:~$ ssh-keygen -v Generating public/private rsa key pair. Enter file in which to save the key (/home/zahra/.ssh/id_rsa): /home/zahra/.ssh/id_rsa already exists. overwrite (y/n)? n
zahra@venus:~$ ssh-keygen -y Enter file in which the key is (/home/zahra/.ssh/id_rsa): Enter passphrase:
zahra@venus:~$ ssh-keygen -l Enter file in which the key is (/home/zahra/.ssh/id_rsa): 2048 b0:a2:17:1a:a9:61:d6:0d:0a:3b:a8:d6:25:d1:2c:f0 /home/zahra/.ssh/id_rsa.pub
You can also change the destination of your keys as the following two examples demonstrate:
zahra@venus:~/.ssh$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/zahra/.ssh/id_rsa): /home/zahra/.ssh/weasel_key Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/zahra/.ssh/weasel_key. Your public key has been saved in /home/zahra/.ssh/weasel_key.pub. The key fingerprint is: 79:45:a7:e2:87:77:11:27:b1:c9:14:57:ab:da:4f:5f zahra@venus
zahra@venus:~/.ssh$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/zahra/.ssh/id_dsa): dsa_test Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in dsa_test. Your public key has been saved in dsa_test.pub. The key fingerprint is: 98:c2:c4:aa:71:a3:c4:72:ef:05:5f:3c:20:60:a6:df zahra@venus