Friday, September 9, 2011

How To SCP Between Servers Without Passwd Authentication

First of all, we need to generate rsa private key and public key for the source server (vice versa).

ssh-keygen -t rsa

then just hit enter until 2 files is generated in /root/.ssh/ :

1. id_rsa
2. id_rsa.pub


then copy the value of id_rsa.pub into /root/.ssh/authorized_keys in any related servers

after that u can scp to the targeted server without passwd authentication :

1. to get file :

scp root@192.168.2.1:/opt/example /opt

2. to get directory and its content :

scp - r root@192.168.2.1:/opt/example /opt

3. to send file :

scp /root/example root@192.168.2.1:/root

4. to send directory and its content :

scp -r /root/example root@192.168.2.1:/root

No comments:

Post a Comment