0

I am manually carrying out a series of files which involves generating files on my local machine and then copying them over to a remote machine.

Currently, I use scp and ssh to perform these tasks. At the moment, eash time I want to ssh into the remote machine, or do a scp, I am (quite rightly), prompted for a password. However, I want to automate the tasks into one script that I can setup to run with cron.

I have seen insecure solutions to this problem, which involve setting the PASSWORD in an environment variable. I am not comfortable with that. Can someone suggest another, more secure way of automating a script that uses ssh and scp?.

BTW, both my local machine and remote machine are running Linux (Ubuntu)

1

Set up authentication key so ssh will not prompt you for a password. e.g. O'Reilly book or Debian You store your public key on the servers and then the private key on the clients

1

Use public key authentication. There's an Ubuntu-specific tutorial here:

https://help.ubuntu.com/community/SSH/OpenSSH/Keys

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.