I'm facing problem when I pull a file from another machine to my machine using SCP. File is successfully transferred but each time it asks for password. I want to run this SCP
command as a cronjob
, How can I save password for this automation?
scp user@abc.com:/usr/etc/Output/*.txt /usr/abc/
user@abc.com's password:
Best Answer
You can do:
(if not already done) generate a set of public and private ssh keys on your machine for your user with:
$ ssh-keygen
Answer the questions in order to generate the set of keys.
copy your public key to the remote host:
$ ssh-copy-id remote-user@remote-host
This will enable login-in from your
username@host
toremote-user@remote-host
without being prompt with p/w authentication.