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.
Author by
Karthik
Updated on September 18, 2022Comments
-
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' almost 9 yearsAnd, for extra security, you can restrict the commands that the key is allowed to run, and even what directories it can access with scp.
-
Karthik almost 9 yearsis there a detailed document from where I can follow the steps. I'm new to unix.
-
Karthik almost 9 yearsis there a detailed document from where I can follow the steps. I'm new to unix.
-
BillThor almost 9 years@Karthik See links above.