in reply to expect using ssh

Please, please *please* don't store (login-) passwords in scripts!

With SSH you have excellent alternatives, a much more secure option being to use host keys. If you generate a key locally (sshkeygen) without password, and exchange the pubkey, you can connect *as this user* without password and without hassle.

Of course, the security is limited to the level of trust you have for the specified account, but that is another story and pretty much under your control.

I have at work a simple step-by-step description, could add that tomorrow if you like...

Update: added links about setting up SSH the proper way. See followup to your duplicated post: Re: Re: Connecting to machines.

--
Cheers, Joe