Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question

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

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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