Hello friends,

I am using jsch to execute remote commands from my web application. 

One of such commands is /bin/su

Since
"/bin/su root /bin/sh -c id " requires a terminal for execution to succeed, i 
have set the ((ChannelExec)channel).setPty(true) for this.
This works fine most of the times on the host, but at some instances this 
command hangs.

The ps output show that above command is still running on the remote host 


root      2139  2138  0 15:42 pts/3    00:00:00 /bin/su root /bin/sh -c id 


I also see the pseudo terminal pts/3 allocated under /dev/pts/3. 

The only problem i see here is when su prompts for the password, it is not 
getting the password pumped in the pseudo terminal  allocated  in time by the 
sshd daemon on the target host.
strace of this process shows it waiting at the read system call.

[root@host1~]# //usr/bin/strace -p 3932
Process 3932 attached - interrupt to quit
read(0,


What are the possible reasons that it could happen like network latency. Will 
changing the baud rate of the terminal help ?
Please suggest some workaround to prevent this hang

thanks,
Prakash

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to