public void doShell(String cmd){
        connected();
        try {
            Channel channel = session.openChannel("exec");
            StringBuffer rst=new StringBuffer();
            InputStream is=null;
            if(channel!=null){
                ((ChannelExec)channel).setCommand(cmd);

                channel.connect();
                is=channel.getInputStream();

                byte[] tmp=new byte[1024];
                int i=-1;
                while((i=is.read(tmp))!=-1)
                    rst.append(new String(tmp,0,i));
//                System.out.println(rst);
            }
            if(channel!=null)
                channel.disconnect();
        } catch (JSchException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }finally {
            disconnect();
        }
    }