8

JSch - How to cope with interactive Linux commands

view full story
linux-howto

http://stackoverflow.com – I have a code which allow me to connect through ssh, run a command and get response back.It works fine but only for the non-interactive commands (like: ls, df which gives the result back immediately after their run). The problem is when I'm trying to run some interactive command like top or passwd code is waiting forever for the response (and of coures getting none). How to cope with interactive commands? I really don't care about the output, I just wanna to run it. public String runCommand(String command) throws Exception { // SSH Channel ChannelExec channelssh = (ChannelExec) (HowTos)