Highly speculative reply (since I don't use Net::SSH::Perl) ...
If there's any substantive basis for your supposition, "(m)ay be the password is sent too early and not recognized," then it may be worth your while to sleep 1 (or more) between sending the su - and the password (or, if that's not feasible, separate into two transmissions. Any system I'm familiar with will throw up a prompt for the password).
Alternately, you may want to consider whether there's a clue in the disparity between narrative and code: "/r/n" versus \r\n.
In reply to Re: send password in ssh
by ww
in thread send su password in ssh
by tmhossain
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |