Tuesday, March 13, 2012

Generate Keys for copying files in Unix/Linux

In order to copy files to a remote machine without being asked for a password we can perform this task to complete this process.

Generate keys on a source system at (/home/user/.ssh/) and place its public key on the destination system on (home/user/.ssh/) with a file named authorized_keys that will be used while file transfer without asking for a password.

Commands

1. Go to Source Machine /home/user/.ssh/
2. Give command
>ssh-keygen -t rsa

i-  it will ask u for a file name,
ii- it will ask for a paraphrase
iii- it will ask for a paraphrase again 

or just enter thrice to create public and private keys.

3. Now copy the content of public key with extension .pub into the destination machine by creating a file name authorized_keys in directory /home/user/.ssh/

4. Now secure copy a file to the remote machine by using scp command and u will not prompt with password any more.

scp file_to_be_copied.txt user@ip-address:/destination_path_on_remote machine

Good Luck!

Author:
Waqas Rafi

0 Comments:

Disclaimer: Independent operated blog, feed backs at kaxxi.khan@gmail.com
© copyright 2011 info-logy.blogspot.com