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

Commented Issue: Remove BaseClient.EnsureConnection from Doc [1637]

$
0
0
Hi,

BaseClient.EnsureConnection() was removed in this commit https://sshnet.codeplex.com/SourceControl/changeset/22554

But its still part of the Doc.
It should be removed there, too.
Comments: ** Comment from web user: drieseng **

This was corrected in the documentation that was uploaded on 2014-04-06 for v2014.4.6 beta 1.


Edited Issue: Remove BaseClient.EnsureConnection from Doc [1637]

$
0
0
Hi,

BaseClient.EnsureConnection() was removed in this commit https://sshnet.codeplex.com/SourceControl/changeset/22554

But its still part of the Doc.
It should be removed there, too.

Closed Issue: High CPU Load when opening a shell session [1555]

$
0
0
When starting a shell session I observe a high CPU load (100% on one core).
I use the following code to connect:


MemoryStream input = new MemoryStream();
MemoryStream output = new MemoryStream();
MemoryStream extOutput = new MemoryStream();
shell = client.CreateShell(input, output, extOutput);
shell.Stopped += new EventHandler<EventArgs>(shell_Stopped);
shell.ErrorOccurred += new EventHandler<Renci.SshNet.Common.ExceptionEventArgs>(shell_ErrorOccurred);
shell.Start();

Thanks for the great library!

David
Comments: No feedback

New Post: SSH.NET

New Post: SSH.NET

$
0
0
I'm not able to reproduce this issue.
Please post the complete stacktrace.

What SSH server are you using, and which version of SSH.NET ?

Commented Unassigned: An operation was attempted on something that is not a socket. [1940]

$
0
0
I keep getting this error when connecting and uploading a file. There are no errors in Event Log or otherwise.

Here's my code:

SSHNet.PasswordConnectionInfo connInfo = new SHNet.PasswordConnectionInfo(xxxxxxxxxxx);

using (var client = new SSHNet.SftpClient(connInfo))
{
client.Connect();
if (client.IsConnected)
{
using (Stream fileStream = EncryptionUtilities.DecryptFile(path))
{
client.UploadFile(fileStream, path);
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}

client.Disconnect();
}

Any suggestions highly appreciated.
Comments: ** Comment from web user: drieseng **

Have you been able to resolve / work around this issue ?
Please provide feedback.

Thanks!
Gert

Closed Issue: SFTP: Uploading Files to the FTP Server has Inconsistent Behavior [1550]

$
0
0
__Method Name:__ UploadFile()

__Issue:__ Files Uploaded to FTP Server has Inconsistent Behavior

I am trying to upload the file from local path to the ftp server, there is no exceptions in the uploadFile() method , but most of the times files were not uploaded and few times empty file was being uploaded.

Here is my code for uploading a file to the server:

using (var sftp = new SftpClient(sftpHost, user, password))
{
sftp.Connect();
string FilePath = "D:\\CurrentTask\\in\\new.txt";
string remoteFileName = "/folderName/filename.txt";

Stream fs = File.OpenRead(FilePath);
sftp.UploadFile(fs, remoteFileName);

sftp.Disconnect();
}

Could you help me to resolve this issue?

Thanks in Advance.
Comments: No feedback.
Please reopen this issue if you have more information, and you're willing to work with us to find and resolve this issue.

Closed Issue: SftpClient.UploadFile Truncates Uploaded File [1533]

$
0
0
I'm uploading a file with 7MB size and the file is truncated to 4.5MB more or less.

I tried a Flush on the Stream but I always has the error

```
streamFile = // Load Stream
streamFile.Flush();
streamFile.Position = 0;

try
{
// Connect to sftp site
this._sftpClient.Connect();

if (!this._sftpClient.IsConnected)
throw new Exception(string.Format("Could'n connect to server {0}", this._sftpClient.ConnectionInfo.Host));

this._sftpClient.UploadFile(streamFile, string.Format("{0}{1}", this.RelativePath, this.FileName), true);
}
catch (Exception error)
{
logger.Error("Error uploading file.", error);
}
finally
{
if (this._sftpClient.IsConnected)
{
try
{ this._sftpClient.Disconnect(); }
catch (Exception error)
{ logger.Error("Couldn't disconnect global SFTP connection.", error); }
}
}
```
Comments: No feedback.
Please reopen this issue if the problem is not fixed for you.

Commented Unassigned: [Retracted] Random Exception on multi-handle wait [1757]

$
0
0
I use renci.sshnet in a multi-threaded/multi-concurrent-connection environment and was observing randome generic exceptions being thrown during heavy testing.

> Using Revision: 28765

The problem was found in Session.cs lines 637 through 646:
```
switch (EventWaitHandle.WaitAny(waitHandles, this.ConnectionInfo.Timeout))
{
// case 0:
// throw this._exception;
case System.Threading.WaitHandle.WaitTimeout:
this.SendDisconnect(DisconnectReason.ByApplication, "Operation timeout");
throw new SshOperationTimeoutException("Session operation has timed out");
default:
break;
}
```
With lines 639 and 670, here commented out, the random general exception was no longer thrown. Upon inspection it was found that the __WaitAny()__ call returns a zero base index to the event handle, in the passed in array of handles, that caused the wait to release. Thus, zero is a valid return value implying wait success. It should not have thrown an exception.
Comments: ** Comment from web user: drieseng **

Do you still have these problems using beta 1 (or SSH.NET built from source) ?

Commented Unassigned: Unable to connect to : Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication." [1871]

$
0
0
Hello,

After doing Import-Module SSH-Sessions, I try to connect as follows:

PS C:> New-SshSession -ComputerName 10.220.12.220 -Username username -Password ***********
Unable to connect to 10.220.12.220: Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication."

I can to it connect using putty. The putty log shows me this (hoe this helps):

2014-01-16 06:53:21 Looking up host "10.220.12.220"
2014-01-16 06:53:21 Connecting to 10.220.12.220 port 22
2014-01-16 06:53:21 Server version: SSH-2.0-OpenSSH_4.2
2014-01-16 06:53:21 Using SSH protocol version 2
2014-01-16 06:53:21 We claim version: SSH-2.0-PuTTY_Snapshot_2010_05_02:r8934
2014-01-16 06:53:21 Doing Diffie-Hellman group exchange
2014-01-16 06:53:21 Doing Diffie-Hellman key exchange with hash SHA-1
2014-01-16 06:53:23 Host key fingerprint is:
2014-01-16 06:53:23 ssh-rsa 2048 <some hex string>
2014-01-16 06:53:23 Initialised AES-256 CBC client->server encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 client->server MAC algorithm
2014-01-16 06:53:23 Initialised AES-256 CBC server->client encryption
2014-01-16 06:53:23 Initialised HMAC-SHA1 server->client MAC algorithm
2014-01-16 06:53:40 Access granted
2014-01-16 06:53:40 Opened channel for session
2014-01-16 06:53:40 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2014-01-16 06:53:40 Started a shell/command
Comments: ** Comment from web user: drieseng **

I fixed a few issues in this area in the latest beta (and one more fix will go into the next beta).
Can you check if you can still reproduce this problem ?

Source code checked in, #40542

Closed Unassigned: ListDirectory does not work with Wild Chars [2393]

$
0
0
When we try to use ListDirectory with a path like /directory1/test/*.txt it returns na exception with message "No Such File".

It's not possible to use Wild Chars? This appears to work on some SFTP servers (maybe Windows versions).

Thank you
Comments: ListDirectory returns all files in a given remote directory, and as such does not all for filtering.
SFTP itself does not provide this functionality, but it is ofcourse easy to implement yourself on top of SFTP.
The SFTP library would still have to retrieve all files in that directory though.

Do not hesitate to reopen this issue if you have more questions.

Commented Unassigned: System.ArgumentOutOfRangeException on Disconnect() [2389]

$
0
0
Version: __2013.4.7.0__

Hey everybody,

I am sporadically getting the following exception while trying to disconnect SftpClient.

__System.ArgumentOutOfRangeException__: Specified argument was out of the range of valid values.
Parameter name: length
at Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle)
at Renci.SshNet.Channels.Channel.Close(Boolean wait)
at Renci.SshNet.Channels.ChannelSession.Close(Boolean wait)
at Renci.SshNet.Channels.Channel.Close()
at Renci.SshNet.Sftp.SubsystemSession.Disconnect()
at Renci.SshNet.SftpClient.OnDisconnecting()
at Renci.SshNet.BaseClient.__Disconnect()__

Code Snippet:
```
if (sftpClient.IsConnected)
sftpClient.Disconnect();
```

Any idea why ?
Comments: ** Comment from web user: drieseng **

Do you more information on this issue ?
I'll be closing this issue in a few days unless I hear back from you.

Thanks!

Source code checked in, #40543

$
0
0
Remove unnecessary assembly references.

Closed Unassigned: System.InvalidOperationException: Dynamic operations can only be performed in homogenous AppDomain [2401]

$
0
0
Hi All,

I am trying to connect to FTP using your binaries and getting below error:
System.InvalidOperationException: Dynamic operations can only be performed in homogenous AppDomain. at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle) at Renci.SshNet.Session.Connect() at Renci.SshNet.BaseClient.Connect()...

My scenario is I am using SharePoint 2013 List event receiver to upload file in SFTP shared location which is working successfully.
I am trying to read the file from same shared location and getting above error. The only thing which is different here is, for reading I am using SharePoint 2013 Timer Job.

Quick response would be appreciated.
Comments: No feedback.

Please reopen this issue if you have more information or questions.

Commented Unassigned: SftpClient and SshClient usage (Renci.SshNet V2013.4.7.0 dll) cannot connect to the logical machine [2369]

$
0
0
Hi,

Currently we are using Renci.SshNet V2013.4.7.0 dll for connecting to FTP host. But seems that it is working correctly if we map to a physical host but fails to connect if it is a logical Host.

The Unix Team in our organisation advised on changing the following options:

StrictHostkeyChecking (needs to be set to no)
UserKnownHostsFile (should be set to /dev/null)
NoHostAuthenticationForLocalHost (should be set to yes)

Can anyone guide us as to how to do these from the application code.

Please advise if you need further details.

Thanks

Ali.
Comments: ** Comment from web user: drieseng **

Can we have an update on this issue ?

Source code checked in, #40544

$
0
0
Unsubscribe from events before we dispose the channel, as we do not want to get these events signaled while disposing.

Commented Unassigned: System.NullReferenceException [2013]

$
0
0
Hi All

I have written a program that only downloads a part of the file using SFTP and adds it to the previously downloaded file. Basically resumes download.

Program works perfectly except when I am testing varies conditions for example losing connection ect.

This code is running in a timer.

To reproduce the error:
1. Put a break on "remote.CopyTo(fs, (int)sftp.BufferSize);"
2. Put a break on "catch (System.Net.Sockets.SocketException)"
3. Start timer to run code.
4. As the copy process starts remove network cable (trying to simulate losing connection).
5. Exception will be thrown "System.Net.Sockets.SocketException" after awhile.
6. Plug network cable in.
7. The code will try run again when the timer is triggered and after a random time the exception "System.NullReferenceException" will be thrown(Doesnt take long).

Full Error:
An unhandled exception of type 'System.NullReferenceException' occurred in Renci.SshNet.dll

Additional information: Object reference not set to an instance of an object.

If I break then I see these lines:
Call stack with external code
Renci.SshNet.dll!Renci.SshNet.Sftp.SubsystemSession.SendData(byte[] data)
Renci.SshNet.dll!Renci.SshNet.Sftp.SftpSession.SendMessage(Renci.SshNet.Sftp.SftpMessage sftpMessage)
Renci.SshNet.dll!Renci.SshNet.Sftp.SftpSession.SendRequest(Renci.SshNet.Sftp.Requests.SftpRequest request)
Renci.SshNet.dll!Renci.SshNet.Sftp.SftpSession.RequestClose(byte[] handle)
Renci.SshNet.dll!Renci.SshNet.Sftp.SftpFileStream.Dispose(bool disposing)
Renci.SshNet.dll!Renci.SshNet.Sftp.SftpFileStream.Finalize()
[Native to Managed Transition]

My Code
```
private int Download(string IP, string UserName, string Password, string FileSource, string Num)
{
int fault = 0;

SftpClient sftp = null;

try
{
using (sftp = new SftpClient(IP, UserName, Password))
{
Logging.Log_To_file("SFTP connecting");
sftp.Connect();
Logging.Log_To_file("SFTP ok");

Int64 length;
using (FileStream check = File.OpenWrite(root + num+ @"\" + OldFile))
{
length = check.Length;
}

using (FileStream fs = File.Create(root + num+ @"\" + PartFile))
{
using (SftpFileStream remote = sftp.OpenRead(FileSource))
{
Int64 length2 = remote.Length;
if (length > length2)
{
remote.CopyTo(fs, (int)sftp.BufferSize);
}
else
{
remote.Seek(length, SeekOrigin.Begin);

remote.CopyTo(fs, (int)sftp.BufferSize);
}
}
}

Logging.Log_To_file("SFTP disconnecting...");
sftp.Disconnect();
Logging.Log_To_file("SFTP Done");
sftp.Dispose();
Logging.Log_To_file("SFTP Disposed");
}
}
catch (SshAuthenticationException)
{
Logging.Log_To_file("Permission denied");

fault = 1;
}
catch (SftpPathNotFoundException)
{
Logging.Log_To_file("No such file");

fault = 1;
}
catch (System.Net.Sockets.SocketException)
{
Logging.Log_To_file("Connection timed out");

fault = 1;
}
catch (Exception e)
{
Logging.Log_To_file("Unknown error occurred with SFTP");

fault = 1;
}
return fault;
}
```

Any help with this problem would be much appreciated, thanks.
Comments: ** Comment from web user: drieseng **

I haven't yet been able to reproduce this issue.

@CarolineB:
Do you have more information you can share ?

New Post: SSH.NET

$
0
0
Thank you for responding. Here is the stack trace
Renci.SshNet.dll!Renci.SshNet.Session.WaitOnHandle(System.Threading.WaitHandle waitHandle) Line 717 C#
Renci.SshNet.dll!Renci.SshNet.Channels.Channel.WaitOnHandle(System.Threading.WaitHandle waitHandle) Line 487 + 0x10 bytes   C#
Renci.SshNet.dll!Renci.SshNet.Channels.ChannelSession.SendExecRequest(string command) Line 176 + 0xe bytes  C#
Renci.SshNet.dll!Renci.SshNet.SshCommand.BeginExecute(System.AsyncCallback callback, object state) Line 243 + 0x21 bytes    C#
Renci.SshNet.dll!Renci.SshNet.SshCommand.Execute() Line 319 + 0x12 bytes    C#
Renci.SshNet.dll!Renci.SshNet.SshClient.RunCommand(string commandText) Line 237 + 0xa bytes C#
TestWrapper.exe!TestWrapper.Program.sftp() Line 459 + 0x10 bytes    C#
TestWrapper.exe!TestWrapper.Program.Main(string[] args) Line 100 + 0x5 bytes    C#


The SSH server I am trying to invoke is
"SSH-2.0-IBM Sterling Connect:Enterprise for UNIX2.5.00"

I seem to be able to connect but cannot invoke commands.

Commented Unassigned: System.ArgumentOutOfRangeException on Disconnect() [2389]

$
0
0
Version: __2013.4.7.0__

Hey everybody,

I am sporadically getting the following exception while trying to disconnect SftpClient.

__System.ArgumentOutOfRangeException__: Specified argument was out of the range of valid values.
Parameter name: length
at Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle)
at Renci.SshNet.Channels.Channel.Close(Boolean wait)
at Renci.SshNet.Channels.ChannelSession.Close(Boolean wait)
at Renci.SshNet.Channels.Channel.Close()
at Renci.SshNet.Sftp.SubsystemSession.Disconnect()
at Renci.SshNet.SftpClient.OnDisconnecting()
at Renci.SshNet.BaseClient.__Disconnect()__

Code Snippet:
```
if (sftpClient.IsConnected)
sftpClient.Disconnect();
```

Any idea why ?
Comments: ** Comment from web user: lior1 **

I will upgrade to the latest version soon and will report back.
You can close this issue.
Thanks for your help.

Viewing all 2955 articles
Browse latest View live


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