sshnet / sshnet/SSH.NET

Connect to ssh-j.com by code

Open
#1,276 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

Hi, I try to write program for test to use ssh-j.com in my application

bug targetClient.Connect(); go timeout why ?

class Program
{
static void Main()
{
string path = System.IO.Directory.GetCurrentDirectory();
Console.WriteLine("Benvenuto nella simulazione di una shell SSH. Digita 'exit' per uscire.");
Console.WriteLine("Percorso corrente:" + path);
string jumpHost = "ssh-j.com";
string jumpUsername = "foo";
string jumpPassword = "";
string targetUsername = "paolob";
string targetPrivateKeyPath = "id_rsa"; // Percorso alla chiave privata del server di destinazione
PrivateKeyFile targetPrivateKey = new PrivateKeyFile(targetPrivateKeyPath);
using (SshClient jumpClient = new SshClient(jumpHost, jumpUsername, jumpPassword))
{
jumpClient.Connect();

         var jumpForwardedPort = new ForwardedPortDynamic("127.0.0.1", 22);
        jumpClient.AddForwardedPort(jumpForwardedPort);
        jumpForwardedPort.Start();

        PrivateKeyAuthenticationMethod am = new PrivateKeyAuthenticationMethod(targetUsername, targetPrivateKey);
        var connectionInfo = new ConnectionInfo(jumpForwardedPort.BoundHost, (int)jumpForwardedPort.BoundPort, targetUsername, am);

        using (SshClient targetClient = new SshClient(connectionInfo))
        {
            targetClient.Connect();

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sample's jumpClient.Connect(), ForwardedPortDynamic setup, and targetClient.Connect() entry points. Reproduce the timeout with the supplied connection details and determine whether the issue can be isolated to the reported SSH.NET behavior; the report does not name a repository file or test, so completion would require a confirmed cause and a focused reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.