Monday 3 September 2012

SCP/SSH without entering password

1. Generate public key at local host
follows,

[root@hp6core1 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
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:
e6:46:ca:ee:10:25:1f:7c:3f:25:de:24:3d:c2:6a:20 root@hp6core1
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|     .   . .     |
|    E = . = =    |
|     = + + B .   |
|    . . S + .    |
|     o *   .     |
|    . o o        |
|     o .         |
|     .o          |
+-----------------+

2. copy pub file to remote host , follows as
[root@hp6core1 ~]# scp /root/.ssh/id_rsa.pub remoet-host:/root/.ssh/authorized_keys

3. Otherwise append the content into authorized keys at remote file in case file exists

No comments:

Post a Comment