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 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: http://pastebin.com/gHFr91Lf

share|improve this question

1 Answer 1

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

 
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.