Jeremy Bopp wrote in post #950260: > On 10/14/2010 5:22 AM, Amit Tomar wrote: >> localhost.cmd("cd /home/dvsdkrp/workdir/smruti") { |c| print c } >> What should i do?? > I want to think that the problem here is that the su program expects to > have a terminal so that it can disable echoing what you type for your > password and then directly read that password. Driving a telnet session > like this does not emulate a terminal and could cause problems for su. > I would expect su to error out rather than cause a timeout though. > > Are you able to configure sudo on that host? If so you can configure it > to allow your account to run the desired command(s) without a password > and then invoke sudo instead of su. > > -Jeremy Hi Jeremy You are right this is how i solved it su_prompt = "Password: " localhost.cmd("String" => "su", "Match" => /#{su_prompt}/) { |c| print } localhost.cmd("passwd") Now its working fine -- Posted via http://www.ruby-forum.com/.