Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like this script to NOT prompt me for a password when I run it. I would like to put a password inside the script that will pass by itself. This is not a root password: It is for an account set up specifically for this purpose.

#!/bin/bash
copyPath=/u/home/topp/Daily
destinationPath=/home/taliesin_oppenheimer
pass=Pass

scp user@host:$copyPath/UserLatency.txt $destinationPath/TXTfiles

scp user@host:$copyPath/ServerLatency.txt $destinationPath/TXTfiles

etc

Ideally, I would like to set a crontab that launches this script every morning, so i can parse the txt files on my local machine as soon as I get in to the office. When I run this right now, I have to enter my password for each file I copy.

Any pointers?

Thanks and best,

-Tali

share|improve this question

migrated from stackoverflow.com May 31 '13 at 2:57

This question came from our site for professional and enthusiast programmers.

1  
Have a look here. –  terdon May 31 '13 at 3:02

1 Answer 1

You should not store a password in a script. The best way to not have your script prompting for a password is to generate an authentication key with ssh-keygen and then copy the public key to the remote server in $HOME/.ssh/authorized_keys.

You can find a lot of tutorials to do this.

share|improve this answer

Your Answer

 
discard

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.