Quantcast
Channel: SSH.NET Library
Viewing all 2955 articles
Browse latest View live

New Post: SftpClient never comes back in Connect

$
0
0
Hello,
I am using Renci.SshNet for SSH.
I am already using this for "sending to" (UploadFile()) and "pulling from" (DownloadFile()) files in the production system with no problems.
I am testing now sending a file to the Test site, and it is "hanging" there indefinitely after the Connect call..
I even tried to set a timeout (OperationTimeout), to no avail.

Here is the code
    bool uploadFile(String long_filename, String short_filename)
    {
       bool success = false;
       using (var sftp = new SftpClient(server, user, passw))
       {
         sftp.OperationTimeout = new TimeSpan(0, 0, 30); // 30 seconds

         // I see this.. 
         showMessage("Connecting..");

         sftp.Connect();

         // .. but don't see this..
         showMessage("Connected..");


         // Move to POLP-To-FDC directory when uploading..
         sftp.ChangeDirectory(@"/POLP-To-FDC/");

         showMessage("Moved to dir..");


         // upload the file 
         using (var filestream = File.OpenRead(long_filename))
         {
           sftp.UploadFile(filestream, short_filename, false);
           showMessage("Uploaded file..");
           success = true;
          }

          showMessage("isconnecting..");
          sftp.Disconnect();

      } // end using

      return success;
    }


New Post: SftpClient never comes back in Connect

$
0
0
ceciliaschultz wrote:
Hello,
I am using Renci.SshNet for SSH.
I am already using this for "sending to" (UploadFile()) and "pulling from" (DownloadFile()) files in the production system with no problems.
I am testing now sending a file to the Test site, and it is "hanging" there indefinitely after the Connect call..
I even tried to set a timeout (OperationTimeout), to no avail.

Here is the code
    bool uploadFile(String long_filename, String short_filename)
    {
       bool success = false;
       using (var sftp = new SftpClient(server, user, passw))
       {
         sftp.OperationTimeout = new TimeSpan(0, 0, 30); // 30 seconds

         // I see this.. 
         showMessage("Connecting..");

         sftp.Connect();

         // .. but don't see this..
         showMessage("Connected..");


         // Move to POLP-To-FDC directory when uploading..
         sftp.ChangeDirectory(@"/POLP-To-FDC/");

         showMessage("Moved to dir..");


         // upload the file 
         using (var filestream = File.OpenRead(long_filename))
         {
           sftp.UploadFile(filestream, short_filename, false);
           showMessage("Uploaded file..");
           success = true;
          }

          showMessage("isconnecting..");
          sftp.Disconnect();

      } // end using

      return success;
    }

New Post: SftpClient never comes back in Connect

$
0
0
I forgot to add that, I have already tested doing the manual upload to the test site with no problems.

New Post: File uploading more than Once

$
0
0
Hi Everyone,

I am using rencissh.net dll to upload file to particular location,
As soon as file got uploaded different thread will pick up the file and delete, and it will start process with in span of a second.
in that span of time file is getting uploaded once again.

How can i avoid uploading of file twice?
Is there any property i need to disable in renci?

Please help me in this.

New Post: Key exchange problems with VShell (no appropriate prime between 1024 and 1024)

$
0
0
I failed to reproduce this issue with VShell 4.2.1 (Win x64).
Are you still able to reproduce this issue ?

Created Unassigned: The requested address is not valid in its context [2798]

$
0
0
Hi,

I am encountering error as stated above. It is encountered upon hitting ```this.client.Connect();``` . Below is the block of code involved, for your reference:

```
public bool Connect() {
bool success = true;
this.ErrorMessage = "";
try
{

//this.client = new Sftp();
this.client = new SftpClient(this.FtpServer, PortNumber, this.UserName, this.Password);
this.client.Connect();//EXCEPTION IS ENCOUNTERED HERE
//this.client.Timeout = getConnectionTimeout();

//if (PortNumber > 0)
//{
// this.client.Connect(this.FtpServer, PortNumber);
//}
//else
// this.client.Connect(this.FtpServer);

//SshPrivateKey privateKey = new SshPrivateKey("key_rsa.pem", this.Password);
//this.client.Login(this.UserName, privateKey);

//this.client.Login(this.UserName, this.Password);
}
catch (Exception ex) {
success = false;
this.ErrorMessage = "SFTP-Connect()|" + ex.Message.ToString();
}
return success;
}
```
By the way, values of __host, port, username, and password__ are:

host = 192.168.70.67
port = 0
username = jamestst
password = thepassword

What have I missed here? Please let me know.

Thank you in advance!

Cheers

New Post: SftpClient never comes back in Connect

$
0
0
Hi ceciliaschultz,

When you are trying to connect manually(via core ftp/winscp/filezilla) how much time it is taking to connect?


First create connectioninfo object by giving your username,port..etc and then increase the time out.

ConnectionInfo connectionInfo
            connectionInfo.Timeout = new TimeSpan(0, 5, 0); //last position is seconds and middle one is minutes

New Post: Key exchange problems with VShell (no appropriate prime between 1024 and 1024)


New Post: Key exchange problems with VShell (no appropriate prime between 1024 and 1024)

$
0
0
drieseng wrote:
I failed to reproduce this issue with VShell 4.2.1 (Win x64).
Are you still able to reproduce this issue ?
Yes, I can still reproduce the problem. Updating to beta sounds like a bad idea for production servers.

Created Unassigned: Server response does not contain SSH protocol identification [2800]

$
0
0
Getting an error Renci.SshNet.Common.SshConnectionException: Server response does not contain SSH protocol identification. at Renci.SshNet.Session.Connect() at Renci.SshNet.BaseClient.Connect() when SFTP server was configured not to return server version.

Would be nice if there was a way to disable version check, possibly configurable?

New Post: VB SSH 2 commands

$
0
0
Hello, im trying to send 2 commands by ssh with Visual Basic but when i send the 1st command the tool stop responding. ssh client connects but the commands are not working i dont know why. (In putty works)
What is wrong?
Private Sub bt_update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_update.Click
        Dim connInfo As New Renci.SshNet.PasswordConnectionInfo("111.111.1.1", TextBox1.Text, TextBox2.Text)
        Dim sshClient As New Renci.SshNet.SshClient(connInfo)
        Dim cmd As Renci.SshNet.SshCommand


        Using sshClient
            sshClient.Connect()

            cmd = sshClient.RunCommand("configure terminal")
            cmd = sshClient.RunCommand("users")

            sshClient.Disconnect()
        End Using
    End Sub

Created Unassigned: Scp slow copy [2801]

$
0
0
Hi,

I've been experimenting with the scp implementation and noticed it is slower compared to the command line tool scp. In my test, it is 5s to copy with scp, and 15s with SSH.NET. Is this expected? If not, what can I do to improve performance?

Thanks,
Manu

Commented Unassigned: Scp slow copy [2801]

$
0
0
Hi,

I've been experimenting with the scp implementation and noticed it is slower compared to the command line tool scp. In my test, it is 5s to copy with scp, and 15s with SSH.NET. Is this expected? If not, what can I do to improve performance?

Thanks,
Manu
Comments: ** Comment from web user: 4I03F2lod **

My timing is actually wrong with the unmodified SSH.NET it takes by default 33s, and I noticed that most of the time it was stuck in a Thread.Sleep (100) in ScpClient.ReadByte, so I changed this to Thread.Sleep(0) and got the 15s.

New Post: Key exchange problems with VShell (no appropriate prime between 1024 and 1024)

$
0
0
Hi,

Upvoting this issue as it has impacted us as well. Will there be a prod release that includes the fix?

The workaround we found was removing the dh algorithms.
conn.KeyExchangeAlgorithms.Remove("diffie-hellman-group-exchange-sha256");
conn.KeyExchangeAlgorithms.Remove("diffie-hellman-group-exchange-sha1");
Thanks!

New Post: No appropriate prime between 1024 and 1024 is available.

$
0
0
The workaround we found was removing the dh algorithm
conn.KeyExchangeAlgorithms.Remove("diffie-hellman-group-exchange-sha256");
conn.KeyExchangeAlgorithms.Remove("diffie-hellman-group-exchange-sha1");> hms.

Updated Wiki: Home

$
0
0

We've moved!

SSH.NET is now available here:
https://github.com/sshnet/SSH.NET

Introduction
This project was inspired by Sharp.SSH library which was ported from java and it seems like was not supported for quite some time. This library is a complete rewrite using .NET 4.0, without any third party dependencies, using parallelism to achieve the best performance possible.

Features
  • Execution of SSH command using both synchronous and asynchronous methods
  • Return command execution exit status and other information
  • Provide SFTP functionality for both synchronous and asynchronous operations.
  • Provides SCP functionality.
  • Provide status report for upload and download sftp operations to allow accurate progress bar implementation
  • Remote, dynamic and local port forwarding
  • Shell/Terminal implementation.
  • Specify key file pass phrase
  • Use multiple key files to authenticate
  • Supports diffie-hellman-group-exchange-sha256, diffie-hellman-group-exchange-sha1, diffie-hellman-group14-sha1 and diffie-hellman-group1-sha1 key exchange methods.
  • Supports 3des-cbc, aes128-cbc, aes192-cbc, aes256-cbc, aes128-ctr, aes192-ctr, aes256-ctr, blowfish-cbc, cast128-cbc, arcfour and twofish encryptions.
  • Supports hmac-md5, hmac-sha1, hmac-ripemd160, hmac-sha2-256, hmac-sha2-256-96, hmac-md5-96 and hmac-sha1-96 hashing algorithms.
  • Supports publickey, password and keyboard-interactive authentication methods
  • Supports RSA and DSA private key
  • Supports DES-EDE3-CBC, DES-EDE3-CFB, DES-CBC, AES-128-CBC, AES-192-CBC and AES-256-CBC algorithms for private key encryption.
  • Supports two-factor or higher authentication
  • Supports SOCKS4, SOCKS5 and HTTP Proxy

Framework Support
  • .NET Framework 3.5
  • .NET Framework 4.0
  • Silverlight 4
  • Silverlight 5
  • Windows Phone 7.1
  • Windows Phone 8.0

Code Samples
Sample code can be found by looking at the test cases included in the source code. Make sure you read the code for tests that is not expected to fail.

Future Features
  • Compression support

Samples and Documentation
SshClient.chm

NDepend

If you have any problems or comments please let me know, if you think its a bug please log it in issue tracker and I will try to address it as quick as possible.

Commented Unassigned: Scp slow copy [2801]

$
0
0
Hi,

I've been experimenting with the scp implementation and noticed it is slower compared to the command line tool scp. In my test, it is 5s to copy with scp, and 15s with SSH.NET. Is this expected? If not, what can I do to improve performance?

Thanks,
Manu
Comments: ** Comment from web user: drieseng **

You should get much better results with the SftpClient, but that's no excuse for the bad results with ScpClient.
Can you please submit an issue at https://github.com/sshnet/SSH.NET (we've moved!) ?

Thanks!
Gert

Updated Wiki: Documentation

$
0
0

We've moved!

SSH.NET is now available here:
https://github.com/sshnet/SSH.NET

Notice: This wiki is a work in progress and may contain dead-links or inaccurate information. Do not file any issues until this notice is removed.

The following is a list of links that might be useful.

Problems using the CHM file on Windows 7 or Windows 8

Windows 7
The CHM file, at least in windows 7, when downloaded, will show broken links and empty pages unless you unblock the file.
  1. Right click on: SshClient.chm # two
  2. Near the bottom of the dialog on the right, you will see an "Unblock" button. Click it!
Windows 8
Start PowerShell and use this command: Unblock-File .\SshNet.chm
Note, you can move to directories like you can in Command Prompt.
Source (superuser.com)

Commented Unassigned: Scp slow copy [2801]

$
0
0
Hi,

I've been experimenting with the scp implementation and noticed it is slower compared to the command line tool scp. In my test, it is 5s to copy with scp, and 15s with SSH.NET. Is this expected? If not, what can I do to improve performance?

Thanks,
Manu
Comments: ** Comment from web user: 4I03F2lod **

Indeed I switched to sftp which provides a way to sync directories and is definitely much faster. I'll fill the issue over at github.

Thanks!

New Post: No appropriate prime between 1024 and 1024 is available.

$
0
0
A new beta is now available here that includes this fix.
Viewing all 2955 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>