How do I scp a file from server A to server B from cron?

15,304

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.

Share:
15,304
Karthik
Author by

Karthik

Updated on September 18, 2022

Comments

  • Karthik
    Karthik over 1 year

    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?

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 9 years
  • Karthik
    Karthik almost 9 years
    is there a detailed document from where I can follow the steps. I'm new to unix.
  • Karthik
    Karthik almost 9 years
    is there a detailed document from where I can follow the steps. I'm new to unix.
  • BillThor
    BillThor almost 9 years
    @Karthik See links above.