1

我需要在大型机上启动一个专有的 SSH 子系统。

我已将我的项目迁移到 dotnet core,但它不支持 ch.ethz.ssh2。我已将 lib 更改为 Renci.SSHNET,但没有在远程机器上启动子系统的命令。

在 ssh2 上

Session sess = conn.openSession();
int term_width = 0;
int term_height = 0;
sess.requestPTY("dumb", term_width, term_height, 0, 0, null);
sess.startSubSystem("xxx");

在 renci.sshnet 我使用 SshClient

ConnectionInfo connInfo = new ConnectionInfo(
    HostIp,
    Port,
    HostUser,
    new AuthenticationMethod[]{
        new PasswordAuthenticationMethod(HostUser,HostPass.TrimEnd()),
    });
msshclient = new SshClient(connInfo);
msshclient.Connect();
4

1 回答 1

1

使用 SSH.NET 的公共 API 似乎是不可能的。

但如果你愿意修改 SSH.NET 代码,那应该是微不足道的。开始于Session.CreateChannelSession.

于 2020-07-20T07:51:37.527 回答