views:

2297

answers:

2

What is the best way of doing SCP from one box to the other without prompting for password?

There are two servers

Server A

10.152.2.10

/home/oracle/export/files.txt

Server B

10.152.2.11

/home/oracle/import/

If I want to transfer the files using scp from Server A to server B without being prompted to enter a password

[running this from Server A, /home/oracle/export/]

scp files.txt [email protected]:/home/oracle/import

This would prompt me for a password upon entering the command.

I understand that a keygen is required to be generated and copied to Server A

Thus[At Server A]: ssh-keygen -t rsa

This gives me two files stored in /home/oracle/.ssh:

id_rsa
id_rsa.pub

  1. Am I supposed to copy the two files (id_rsa,id_rsa.pub) over into Server B /home/oracle/.ssh ?

While doing some google search on this, some articles mentioned about appending/concatenating this to authorized_keys.

  1. Am I supposed to create this file on my own?

I seem to be confused on what is the right way to do this.

Btw, the two servers are running Suse Linux Enterprise Edition 9...

Please advice.

+6  A: 
  1. No, you keep id_rsa to yourself; however, id_rsa.pub, which is your public key, may be copied to servers to which you wish to have access. Concatenate them onto the end of ~/.ssh/authorized_keys.
  2. Yes, you may create ~/.ssh/authorized_keys if it is not already created; otherwise, just append to the end of the file, using cat id_rsa.pub >>~/.ssh/authorized_keys.
mipadi
+1  A: 

You should also check the permissions on the various files and directories:

authorized_keys needs perms of 600 (chmod 600 authorized_keys)
the .ssh directory should be 700
your home directory should be at most 744

Your home directory must not be writable by anyone other than you.

dr-jan