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 have script that runs remote login using SSH, copies a file from that remote machine using SCP without asking for a password, however, the change only works for the terminal where I am running the script. If I try to execute this same script on a different terminal, it will prompt me for a password.

Is there a way I can create a script that will prompt for my password once, then not ask for my password the next time the script is run?

share|improve this question

3 Answers 3

Use the ssh-copy-id [user@]machine command to install your public key in the remote machine's authorized_keys.

share|improve this answer

ssh is rather paranoid of its passwords. You can use its drop-in replacement from putty, it allows to load password from file or even command-line.

share|improve this answer

You can setup a master SSH connection that accepts multiplexing connections. See the options -M and -S of the SSH client manual.

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.