[OT] SSH login script - Help

Bill Davidsen davidsen at tmr.com
Sun Apr 26 01:55:32 UTC 2009


Dan Track wrote:
> Hi Guys,
> 
> I've written a simple for loop see below:
> 
> for i in orion earth;do scp /etc/hosts /etc;done
> 
> I have a small scripting knowledge so would appreciate some help. What
> I'd like to do is somehow change the above so that the script prompts
> me for a password and when I give the script the password it will use
> it to auto-reply to any password promtps that scp asks for when
> logging into all the servers. If I am right I believe readline needs
> to be used. If it can't be done in bash can you give me a perl
> alternative please.
> 
Is there a benefit from not just using a login key (in authorized keys) to 
eliminate the need for passwords and also have the security of a single command 
which could be executed using the key?

I do my backups that way, just passing an argument of full, incr, or config to 
the remote machine and saving the stdout to a file. Security note: the remote 
machine is free to compress or encrypt the data, so the machine providing 
storage need not have access to the data.

-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot




More information about the users mailing list