sftp Questions - Rebex Q&A Forum (C#, VB.NET)most recent 30 from http://forum.rebex.net2010-09-08T14:26:23Zhttp://forum.rebex.net/feeds/tag/sftphttp://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://forum.rebex.net/questions/99/trying-to-use-rebex-to-do-ftps-but-force-validation-of-certificatetrying to use Rebex to do FTPS but force validation of certificateFranklin2010-03-08T19:32:26Z2010-09-08T01:24:27Z
<p>I need to do FTP with SSL (FTPS). I can connect to the server (3rd party) using SecureFX if I check the Disable certificate validation, so that tells me their certificate isn't being validated correctly, but I can't do anything about that...the security is for their benifit so if they don't do it right, I don't care. What I do care about is being able to download the files using FTPS which I can't seem to get to work with Rebex as I can't figure out how to disable certificate validation. Is there a way?</p>
<pre><code> Dim f As New Rebex.Net.Sftp()
f.Connect(Host)
f.Login(UserID, PW)
f.GetFiles("/ftprca/Outbound/epic", "c:\aatemp\", Rebex.Net.SftpBatchTransferOptions.Default, Rebex.Net.SftpActionOnExistingFiles.OverwriteAll)
f.Disconnect()
</code></pre>
http://forum.rebex.net/questions/167/how-to-reconcile-multiple-versions-purchased-at-different-timesHow to reconcile multiple versions purchased at different timesEric McKnight2010-04-14T18:30:52Z2010-09-07T22:24:39Z
<p>I just purchased the SFTP package since I needed to do secure ftp transfers for one of my new customers. So I downloaded the package and the secure ftp works fine. But now, my regular Rebex.Net.Ftp.dll (downloaded in 2008) won't work because it's version 2.5.3127 and it relys on the Rebex.Net.ProxySocket.dll which I now have 3 versions of (1) Rebex.FTP (2) FTP/SSL and now (3) Rebex.Net.SFtp.dll. I have a class library that needs to use regular FTP and SFTP. Here's the scenario:</p>
<p>Class Libary B needs to use Rebex.Net.Sftp.dll for Secure Ftp
Class Libary B needs to use Rebex.Net.Ftp.dll for regular Ftp </p>
<p>These two dlls have dependencies with the same file name that are now different versions and won't work together. </p>
<p>I do not want to have to buy the upgrade to fix this issue. How can I resolve this issue? </p>
<p>UPDATE:
I have already received an email back from support to resolve this issue. They were very responsive and extremely helpful.</p>
http://forum.rebex.net/questions/115/key-exchange-failed-error-while-sending-packetKey exchange failed. Error while sending packetAdam2010-03-18T21:49:10Z2010-09-07T20:24:07Z
<p>I am new to FTP\SFTP components, and am attempting to use your Sample Winforms application to connect to a secure public ftp server. I get the same error in your example application that I got in my application, which is "Key exchange failed. Error while sending packet" I can use coreftp lite to connect and navigate just fine. The first time it connects, it asks me to accept their key. Other than that, it works just like any other FTP program. I am not given a pre-shared key or any of that mess. Using your example, I chose verbose logging and got the following:</p>
<pre><code>14:39:16.206 Debug SSH: Negotiation failed: Rebex.Net.SshException: Key exchange failed. Error while sending packet. ---> Rebex.Net.SshException: Error while sending packet. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Rebex.Net.ProxySocket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Rebex.Net.SshSession.1685053200(11634889349 , Boolean )
--- End of inner exception stack trace ---
</code></pre>
http://forum.rebex.net/questions/104/is-there-64bit-supportIs there 64bit support?Jeff2010-03-12T01:42:13Z2010-09-07T16:23:49Z
<p>Does the FTP and SFTP support 64bit? I'm not interested in working in the wow6432 environment. I need native 64bit from c#.</p>
http://forum.rebex.net/questions/358/abort-a-specific-async-transferAbort a specific async transferPaul2010-07-20T17:39:12Z2010-09-07T15:23:52Z
<p>AbortTransfer has an object parameter to help identify which operation to abort but I could not find any examples on how to use it. If I launch two BeginGetFile(s), how do I abort a specific one using AbortTransfer?</p>
<p>Regards,</p>
<p>Paul</p>
http://forum.rebex.net/questions/268/preserver-date-created-timestamp-on-sftp-transfersPreserver Date Created Timestamp on SFTP transfersChristian2010-06-01T04:03:13Z2010-09-07T12:23:49Z
<p>Hi,</p>
<p>I would like to preserve the original creation date/time and modified date/time after a file has been transfered.</p>
<p>Is there a way of doing this? I know WinSCP offers this option, so I assume it is possible</p>
<p>Regards,
Christian</p>
http://forum.rebex.net/questions/467/rebex-net-sshexception-received-invalid-packetRebex.Net.SshException: Received invalid packet.Mike2010-09-01T18:21:42Z2010-09-01T18:21:42Z
<p>I'm able to connect using SFTP but when I send login credentials I am receiving an error? Any ideas? </p>
<p>The Log:
2010-09-01 11:08:21.687 Opening log file.
2010-09-01 11:08:21.875 ERROR Sftp(5) Info: Rebex.Net.SshException: Received invalid packet.
at wWGvS.AIchsYZ.AcUJKJ(Byte[] )
at Rebex.Net.SshSession.AePCoRZ(Byte[]& )
at Rebex.Net.SshSession.cDtmAOZ(Int64& , Boolean )
at Rebex.Net.SshSession.CFLiXJ(ANiLIV )
at Rebex.Net.SshSession.CgoKrJZ()
at Rebex.Net.SshSession.cCIjvV(String , String , SshPrivateKey , SshGssApiCredentials )
at Rebex.Net.SshSession.Authenticate(String userName, String password, SshPrivateKey privateKey)
at Rebex.Net.Sftp.Login(String userName, String password, SshPrivateKey privateKey)
2010-09-01 11:10:50.046 Opening log file.
2010-09-01 11:10:50.046 INFO Sftp(7) Info: Connecting to www.xyz.com:22 using Sftp 2.0.3854.0 (trial version).
2010-09-01 11:10:50.265 DEBUG Sftp(7) SSH: Server is 'SSH-2.0-OpenSSH_4.3'.
2010-09-01 11:10:50.265 DEBUG Sftp(7) SSH: Negotiation started.
2010-09-01 11:10:50.328 DEBUG Sftp(7) SSH: Group exchange.
2010-09-01 11:10:50.406 DEBUG Sftp(7) SSH: Negotiating key.
2010-09-01 11:10:51.343 DEBUG Sftp(7) SSH: Validating signature.
2010-09-01 11:10:51.359 DEBUG Sftp(7) SSH: Negotiation finished.
2010-09-01 11:10:51.359 INFO Sftp(7) Info: Server: SSH-2.0-OpenSSH_4.3
2010-09-01 11:10:51.359 INFO Sftp(7) Info: Fingerprint: d7:f3:65:20:ad:9c:3c:23:0e:cd:d4:d3:32:a9:42:c3
2010-09-01 11:10:51.359 INFO Sftp(7) Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, aes256-ctr/aes256-ctr, SHA1/SHA1</p>
<p>The Code:
Sftp client = new Sftp();
client.LogWriter = new Rebex.FileLogWriter(@"c:\work\log2.txt", Rebex.LogLevel.Debug);
// Create an instance of SshParameters class
// to specify desired arguments.
SshParameters par = new SshParameters();</p>
<pre><code> // Disable transfer compression
par.Compression = false;
// Any key exchange method is acceptable.
par.KeyExchangeAlgorithms = SshKeyExchangeAlgorithm.DiffieHellmanGroupExchangeSHA1;
// Only allow AES and 3DES encryption methods.
par.EncryptionAlgorithms = SshEncryptionAlgorithm.AES | SshEncryptionAlgorithm.TripleDES;
// Connect to the server.
// The third argument refers to the parameters class.
client.Connect(FTPHost, Sftp.DefaultPort, par);
// verify the server's fingerprint (client.Fingerprint)
SshPrivateKey privateKey = new SshPrivateKey(@"c://work/key_rsa.pem", "password");
// authenticate
client.Login(FTPUser, privateKey);
client.Disconnect();
</code></pre>
http://forum.rebex.net/questions/301/connect-timeout-settingConnect timeout setting?Guido2010-06-23T09:48:25Z2010-09-01T13:23:53Z
<p>HI,</p>
<p>Can you tell me what the timeout settings are in the sftp component? We have a very slow sftp server and want to make sure that we won't run into trouble with connection or authentication timeouts. I tried to find out if timeouts are configurable, but was unable to find any information. </p>
<p>Thanks.</p>
http://forum.rebex.net/questions/460/unable-to-recover-sftp-connection-after-network-errorUnable to recover Sftp connection after network errorSergey Z.2010-08-30T09:01:17Z2010-08-30T11:00:14Z
<p>Hi, </p>
<p>I'm using Rebex Sftp component to perform a long time job on the server. This job should be able to recover after server/network errors. First, I tried to call SftpClient.Connect second time (after failure), this didn't help. Then I tried to disconnects and dispose a broken SftpClient, create new, connect and continue with the new one. Now I could connect to the server successfully, but when I called PutFile I got an exception with the message "Failure; Failure".</p>
<p>What should I do to be able to recover after network falures? Many thanks.</p>
http://forum.rebex.net/questions/405/cant-log-in-with-sftpCan't log in with SFTPTravis2010-07-29T14:55:42Z2010-08-27T19:23:59Z
<p>When trying to log in using SFTP I get this exception: "Message with invalid length 707406378 was received." I can connect to the server but I can not log in.</p>
http://forum.rebex.net/questions/456/login-name-and-password-creationLogin name and password CreationAya Ayman2010-08-26T08:22:07Z2010-08-27T18:38:09Z
<p>In the simple WinForm SFTP client, on the connect button it asks for user name and password,
where do i get those or how do i create them??</p>
http://forum.rebex.net/questions/149/issue-cannot-reuse-session-across-sftp-ssh-scp-etcIssue: Cannot reuse Session across Sftp, Ssh, Scp, etcStephen Zebo2010-04-06T04:51:19Z2010-08-27T18:24:07Z
<p>The object Sftp, Ssh, Scp have a property named <strong>Session</strong>, which allows access to the SSH session. However there is no <strong>set</strong> implementation for this property. There is no way to open one session and use it for Sftp, Ssh, Scp simultaneously. This is an issue because there are servers with limitation on the number of sessions you can open at the same time.</p>
<p>Any comments guys?</p>
http://forum.rebex.net/questions/455/setting-sftp-file-propertiesSetting SFTP File PropertiesAndy Blum2010-08-25T18:41:30Z2010-08-26T09:32:38Z
<p>How do I use the Rebex API to set file properties on a remote file server.</p>
http://forum.rebex.net/questions/359/setfiledatetime-no-longer-works-in-version-2-0-3854SetFileDateTime no longer works in version 2.0.3854Paul2010-07-20T20:50:07Z2010-08-18T09:23:54Z
<p>It was running fine in with v1.5.3127. I upgraded to the latest release v 2.0.3854 and I'm now getting an error when calling SetFileDateTime. We are running WS_FTP server v6.1.0.0 .</p>
<p>The error I'm now getting is:</p>
<pre><code>Rebex.Net.SftpException was unhandled
Message="Unsupported operation; SSHServerAPI.SFTP.fxp_attrs."
Source="Rebex.Net.Sftp"
Transferred=0
StackTrace:
at wWGvS.APnbEo.sxMvMZ(BBdsJfZ , Type )
at wWGvS.APnbEo.Bindhs(String , SftpAttributes )
at Rebex.Net.Sftp.SetFileDateTime(String remotePath, DateTime newDateTime)
at APS.Shared.Core.Implementation.SftpService.renameUploadFile(TransferFileInfo transferFileInfo) in C:\Users\pleury\Documents\Development\AustinPS\APS_Shared\src\APS.Shared\Core\Implementation\SftpService.cs:line 142
at APS.Shared.Core.Implementation.SftpService.uploadCallback(IAsyncResult asyncResult) in C:\Users\pleury\Documents\Development\AustinPS\APS_Shared\src\APS.Shared\Core\Implementation\SftpService.cs:line 124
at wWGvS.cLikxD.AExGBoZ()
at wWGvS.cLikxD.PyHMxZ.AExGBoZ()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
</code></pre>
<p>Regards,</p>
<p>Paul</p>
http://forum.rebex.net/questions/101/ftp-version-to-useFTP Version to UseCarl Mitchell2010-03-10T18:52:03Z2010-08-10T13:34:36Z
<p>I am a novice with secure FTP. I am developing a Windows application in VS-2008 with framework 3.5 and need to download and upload files. From what I am told is this will be to/from an SSH FTP server running on either port 21 or 22 -- can't recall right now.</p>
<p>I'll need to get file size so I can compare it to the downloaded file's size unless there is a better way to do it. </p>
<p>I understand that there is a login and password for the FTP site and that I will need to supply a public key (private key?) supplied to me by the site administrator. </p>
<p>I need to know which package would be best to download and later purchase. I would like to keep this as simple as possible</p>
<p>Any advice would be most appreciated.</p>
<p>Carl Mitchell
GasAmerica Services
carl.mitchell@gasamerica.com.</p>
http://forum.rebex.net/questions/233/difference-between-uploadbufferlength-and-tcpclient-sendbufferDifference between UploadBufferLength and TcpClient.SendBuffer?Michael Hamrah2010-05-13T12:45:12Z2010-08-10T13:22:48Z
<p>In relation to this question, <a href="http://forum.rebex.net/questions/173/how-to-optimize-transfer-performance-with-uploadbufferlength" rel="nofollow">http://forum.rebex.net/questions/173/how-to-optimize-transfer-performance-with-uploadbufferlength</a>, we're still seeing slower ftp upload times than we'd like. The post mentions another option, UseLargeBuffers, which may be available. We'd be interested in this option.</p>
<p>I'm curious what the difference is between UploadBufferLength and the TcpClient.SendBuffer size. Looking at wireshark logs, it appears our send buffer is quite small, even though we've set the upload buffer length to 128k.</p>
<p>Thanks,</p>
<p>Mike</p>
http://forum.rebex.net/questions/173/how-to-optimize-transfer-performance-with-uploadbufferlengthHow to Optimize Transfer Performance with UploadBufferLength? Michael Hamrah2010-04-20T15:13:46Z2010-08-10T13:22:38Z
<p>In some performance tests, we're getting slower Ftp Upload times with our Rebex library than compared with FileZilla. Looking at the network traffic, I noticed all packet sizes from our system were the default 4096 bytes, while FileZilla seemed to do some dynamic changing of packet sizes while uploading (ranging from 2000-11000 bytes). I'm wondering if anyone has modified the UploadBufferLength and saw an increase in transfer speeds, or if there was a way to auto-size the UploadBufferLength to increase performance?</p>
<p>Any other ways to increase performance (I'm uploading jpeg images only) will be appreciated.</p>
http://forum.rebex.net/questions/414/sftp-aborting-beginconnect-beginlogin-changedirectorySftp: Aborting BeginConnect, BeginLogin, ChangeDirectory_FRED_2010-08-02T14:41:01Z2010-08-03T09:31:49Z
<p>A Sftp class has one AbortTransfer method, that "Aborts pending transfers". Does this method aborts not-transfer operations, such as connecting, logging or changing current directory?</p>
<p>Does Ftp::Abort aborts connecting, logging or changing current directory?</p>
http://forum.rebex.net/questions/334/common-interface-usage-for-ftp-and-sftpCommon interface/usage for FTP and SFTPAkshay2010-07-12T18:58:10Z2010-07-29T11:25:24Z
<p>Is there a version of the library that has a common interface for Ftp and for Sftp. I need to toggle between the two in a library however because I don't see a common interface, I essentially have to duplicate all the code, with exactly the same calls.</p>
http://forum.rebex.net/questions/68/how-to-check-that-file-transfered-matches-bit-for-bit-with-local-to-remoteHow to check that file transfered matches bit for bit with local to remote?Richard2010-02-24T17:50:32Z2010-07-29T01:23:53Z
<p>We have a customer complaining that the audio files being transfered to their ftp site are not matching the original MD5 hash. The file transfer is completing without error yet the files do not match exactly. How can we check this?</p>
<p>Our app is built using VB.Net.</p>
<p>Thanks, Richard</p>
http://forum.rebex.net/questions/384/cancelling-sftpbegingetfileCancelling Sftp::BeginGetFile(…)_FRED_2010-07-26T14:26:12Z2010-07-26T16:19:00Z
<p>I'm using the code like below for starting and cancelling operations:</p>
<pre><code>var client = new Sftp();
// Connecting
client.BeginGetFile("Source", "Destination", null, null);
// …
if (NeedToCancel()) {
client.AbortTransfer(); // (*)
}//if
</code></pre>
<p>Some times, the code in line (*) called before async operation really started (scheduled), and it does not cancelled. Is this a good idea to subscribe for Sftp::TransferProgress event and aborting operation within? Like this:</p>
<pre><code>var client = new Sftp();
var cancelled = false;
// Connecting
client.TransferProgress += (sender, e) => {
if (cancelled) {
client.AbortTransfer(e.Id);
}//if
};
client.BeginGetFile("Source", "Destination", null, null);
// …
cancelled = NeedToCancel();
</code></pre>
<p>Does Sftp class have other case for determinate, that async operation is scheduled and can be cancelled?</p>
http://forum.rebex.net/questions/371/sftpbegingetfile-causes-releasehandlefailed-mdaSftp::BeginGetFile causes "releaseHandleFailed MDA"_FRED_2010-07-22T11:12:20Z2010-07-23T14:32:06Z
<p>ReleaseHandleFailed was detected
Message: A SafeHandle or CriticalHandle of type 'Microsoft.Win32.SafeHandles.SafeCapiKeyHandle' failed to properly release the handle with value 0x033BFF60. This usually indicates that the handle was released incorrectly via another means (such as extracting the handle using DangerousGetHandle and closing it directly or building another SafeHandle around it.)</p>
<p><a href="http://msdn.microsoft.com/en-us/library/85eak4a0.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/85eak4a0.aspx</a>
http://social.msdn.microsoft.com/Search/en-US/?Query=ReleaseHandleFailed</p>
<p>Can this issue was fixed?</p>
http://forum.rebex.net/questions/368/sftpbegingetfile-blocks-local-destination-file-from-reading-during-downloadinSftp::BeginGetFile blocks local (destination) file from reading during downloading_FRED_2010-07-21T15:35:40Z2010-07-23T10:06:41Z
<p>Can you share a local file for reading?
I know, that I can use an overloading with Stream parameter, but default behavior is strange.</p>
<p>I'm using the following code:</p>
<pre><code>var client = new Sftp();
client.Connect("Server");
client.Login("UserName", "Password");
var destinationFile = @"C:\Temp\Eee.txt";
var destination = destinationFile;
//var destination = new FileStream(destinationFile, FileMode.Create, FileAccess.Write, FileShare.Read);
client.BeginGetFile("FileName.txt", destination, null, null);
while (!File.Exists(destinationFile))
{
Thread.Sleep(100);
}
var test = new FileStream(destinationFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
// "The process cannot access the file 'C:\\Temp\\Eee.txt' because it is being used by another process."
</code></pre>
<p>If you uncomment line "var destination = new FileStream(…" (and comment "var destination = destinationFile;"), the test stream opens successfully.</p>
http://forum.rebex.net/questions/326/authentication-exception-server-requires-additional-authentication-with-gssapAuthentication exception - server requires additional authentication with: 'gssapi-with-mic,password'Doug2010-07-01T14:50:59Z2010-07-01T15:56:53Z
<p>The administrator of an FTP site recently changed their server configuration, and I am now receiving the following error:</p>
<pre><code>Rebex.Net.SftpException: Authentication was partially successful, but server requires additional authentication with: 'gssapi-with-mic,password'
</code></pre>
<p>The release notes seem to indicate that Build 3479 supports GSSAPI (I'm using build 3793), but I haven't been able to find any examples of how to enable GSSAPI (and I freely admit I don't know anything about GSSAPI).</p>
<p>Here is the code snippet I'm using to connect using SFTP:</p>
<pre><code> _connection = new Sftp();
_connection.Connect(hostname);
Assembly assembly = Assembly.GetExecutingAssembly();
using (Stream stream = assembly.GetManifestResourceStream(keyFileName))
{
SshPrivateKey key = new SshPrivateKey(stream, sshPassword);
_connection.Login(userName, key);
}
</code></pre>
<p>What do I need to change to get GSSAPI working?</p>
http://forum.rebex.net/questions/260/can-i-retrieve-the-logged-in-users-userid-and-group-list-using-sftpCan I retrieve the logged-in user's userid and group list using SFTP?Bill W2010-05-27T18:32:39Z2010-05-28T14:03:49Z
<p>SftpItem objects provide the owner and group name and IDs, but I do not see a way to check if this applies to the current user except by remembering what name I supplied to Login(). Is it possible using Rebex's SFTP component to retrieve the current user's name, id, and a list of groups the user belongs to?</p>
http://forum.rebex.net/questions/61/file-upload-with-rebex-sftp-isnt-working-properlyFile upload with Rebex SFTP isn't working properlySohail Shaukat2010-02-18T16:13:12Z2010-05-21T13:34:30Z
<p>Downloads are working properly for any file size. However, file uploads are working only for size less than 5 kb. Globalscape SFTP server is used.
If we try the offset command, lets say for a file which is 200 kb, it transfers only 5 kb.</p>
<p>It even generates an error which says "Connection has been closed by the remote connection end...". However if CUTEFTP client is used, files are getting transferred. Please help</p>
http://forum.rebex.net/questions/10/how-to-create-a-log-of-communication-between-component-and-serverHow to create a log of communication between component and server?Rebex KB2010-01-12T19:34:14Z2010-04-16T15:03:59Z
<p>Is it possible to create a detailed log of communication between client (component) and the server? It would help us detect problem sources. The log should include:</p>
<ul>
<li>Commands sent by client</li>
<li>Responses received from server</li>
<li>Description of activities</li>
</ul>
http://forum.rebex.net/questions/43/how-to-get-kilobytes-per-second-for-file-uploadhow to get kilobytes per second for file upload?Richard2010-02-02T22:04:05Z2010-03-17T14:44:16Z
<p>Is there some property or method to measure and display the kilobytes per second of a file transfer for both Ftp and Sftp?</p>
<p>Thanks in advance,
Richard</p>
http://forum.rebex.net/questions/58/sftp-channel-has-been-closedSFTP "Channel has been closed"Lynda2010-02-15T14:56:08Z2010-03-17T14:32:45Z
<p>I am successfully using SFTP to get files from one site; however, I get an error message of "Channel has been closed" when the same program uses SFTP to a different location. </p>
<p>I suspect the second location is not defined for SFTP. Would that generate the message "The Channel has been closed"? If not, what would cause this message? The administrator of the second location is not a dedicated IT person so if I have specific questions for him, he can obtain answers for me.</p>
<p>I would appreciate your insight on this error message. Thanks!</p>
http://forum.rebex.net/questions/39/sftp-transfer-statusSFTP Transfer StatusCarl2010-01-29T16:42:20Z2010-03-02T15:20:00Z
<p>Hello,</p>
<p>I have a VB.Net Windows app that is transferring 1 file using Rebex.Net.SFTP.</p>
<p>It works fine, but I need to know the status of the transfer so I can create my own log file.</p>
<p>How do I get the transfer status telling it the transfer had a problem or completed successfully?</p>
<p>MANY thanks</p>