4

I have a file in server A which I am able to do transfer to server B using scp. I need to do this through a cron entry. server B has a password. How do I perform this?

Karthik
  • 57

2 Answers2

8

Don't use password authentication. Use ssh keypairs.

Karthik@A $: ssh-keygen    #keep the passphrase empty
Karthik@A $: ssh-copy-id B #enter your B password
#^ this will copy your public key to Karthik@B:.ssh/authorized_keys

From then on, you should be able to ssh from A to B (and by extension, scp from A to B) without a password.

Petr Skocik
  • 28,816
0

Generate an ssh-key on server A using ssh-keygen. This will generate a private and public key pair in $HOME/.ssh. Add the public key to the $HOME/.ssh/authorized_keys file on server B.

You can use the man command to get more information. The command man authorized_keys will present the manual page that discusses authorized keys.

Try the following sites for discussions:

BillThor
  • 8,965