I
have 2 machine :-
a) 192.168.1.6
{server.example.com}
b)
192.168.1.110 {station110.example.com}
1 :- Create the key using ssh-keygen on 1st
machine i.e. {server.example.com(192.168.1.6)}
[root@server
~]# ssh-keygen
Generating public/private rsa key pair. (Press Enter)
Enter file in which to save the key (/root/.ssh/id_rsa)
(Press Enter)
Enter passphrase (empty for no passphrase): (Press Enter)
Your identification has been saved in
/root/.ssh/id_rsa.
Your public key has been saved in
/root/.ssh/id_rsa.pub.
The
key fingerprint is:
7f:b9:07:00:57:a0:55:c3:97:3f:f8:2d:36:53:ad:c4
root@server.example.com
The key's randomart image is:
+--[ RSA 2048]----+
|
o=+ . |
| .o.
..o |
| .o o...|
| . .E.+|
| S . ..oo|
| . ..*..|
| . oo +
|
| .
.. |
|
.. |
+-----------------+
2
:- Copy The Key to Second Machine using ssh-copy-id
[root@server
~]# ssh-copy-id -i /root/.ssh/id_rsa.pub
root@192.168.1.110
or
[root@server
~]# ssh-copy-id -i /root/.ssh/id_rsa.pub
station110.example.com
[root@server ~]#Enter Password {only one time password entered of 2nd
machine i.e. station110.example.com(192.168.1.110)}
Now try logging into the machine, with "ssh
'station110.example.com'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you
weren't expecting.
3
:- Login to Second Machine {i.e. station110.example.com (192.168.1.110)}
[root@server
~]# ssh -Y 192.168.1.110
Last login: Mon Mar 18 02:36:34 2013 from
192.168.1.6 {Now This Time It Will Not Ask Any Password }
[root@station110 ~]# hostname
station110.example.com
[root@station110 ~]#
__________________________________________
If You See Error Like Agent admitted failure to sign using the key
then-
This problem will fix using
the command #ssh-add
[root@server ~]# ssh-add
No comments:
Post a Comment