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 have a script that I use to set up my laptop automatically with all of my settings. I experiment with different Linux distributions constantly on this laptop, so it is very useful to have a script like this to pull in all my settings fresh after an install. It works well, but it asks for my password multiple times. I know it's because I'm using scp multiple times, but I'm not quite sure if maybe my password can be cached and reused for the rest of the script after the first entry?

Here is the script:

share|improve this question

Create a "null" SSH session in the background that generates a master connection (see the ControlPath and ControlMaster options in the ssh_config(5) man page). Using the same control settings for each SSH/SCP operation will use the existing connection instead of reauthenticating with the server. Don't forget to kill the null session once the script is done.

share|improve this answer
Unfortunately, that would defeat the purpose. The idea is to be able to run my script against a fresh install of a distribution. If I have to modify config files to get the script to function, I may as well do the entire thing manually. Is there a way to cache the password without relying on the config file? – jlacroix82 Aug 19 '12 at 19:47
@jlacroix82: Have you looked at the doumentation for ssh yet? Specifically the -o flag? – Ignacio Vazquez-Abrams Aug 19 '12 at 19:50
Yes, I have read through it but I don't see anything that specifically mentions what I'm asking for unless I'm missing something. – jlacroix82 Aug 19 '12 at 21:16
The second sentence of my answer goes over this. – Ignacio Vazquez-Abrams Aug 19 '12 at 21:30

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.