Sending commands to server via JSch shell channel

后端 未结 9 984
渐次进展
渐次进展 2020-11-30 03:37

I can\'t figure it out how I can send commands via JSch shell channel.

I do this, but it doesn\'t work:

JSch shell = new JSch();
String command = \"c         


        
9条回答
  •  余生分开走
    2020-11-30 04:01

    Usage:

    String remoteCommandOutput = exec("ssh://user:pass@host/work/dir/path", "ls -t | head -n1");
    String remoteShellOutput = shell("ssh://user:pass@host/work/dir/path", "ls")
    shell("ssh://user:pass@host/work/dir/path", "ls", System.out)
    shell("ssh://user:pass@host", System.in, System.out);
    

    Implementation

提交回复
热议问题