http://qs321.pair.com?node_id=862803


in reply to Re: send su password in ssh
in thread send su password in ssh

I have used Net::SSH::Expect to perform this task with both key-based and password authentication.

Any expect-capable script should resolve any of your timing concerns.