edtFTPnet/PRO - Secure FTP component for .NET | Free Trial | Pricing
Click or drag to resize

SSHFTPClient Class

Provides low-level access to SFTP functionality.
Inheritance Hierarchy

Namespace:  EnterpriseDT.Net.Ftp.Ssh
Assembly:  edtFTPnetPRO (in edtFTPnetPRO.dll) Version: 12.3.0.0
Syntax
public class SSHFTPClient : SSHSCPClient

The SSHFTPClient type exposes the following members.

Constructors
  NameDescription
Public methodSSHFTPClient
Default constructor.
Top
Properties
  NameDescription
Public propertyAuthenticationMethod
Get or set the current authentication method being used.
(Inherited from SSHSCPClient.)
Public propertyClientPrivateKeyBytes (Inherited from SSHSCPClient.)
Public propertyClientPrivateKeyFile
Path of the private key file used to authenticate the client
(Inherited from SSHSCPClient.)
Public propertyClientPrivateKeyPassphrase
Passphrase of the private key file.
(Inherited from SSHSCPClient.)
Public propertyCloseStreamsAfterTransfer
If true then streams are closed after a transfer has completed.
(Inherited from SSHSCPClient.)
Public propertyControlPort
The port on the server to which to connect the control-channel.
(Inherited from SSHSCPClient.)
Public propertyCountBeforeSleep
Number of transfers before going to sleep
Public propertyDefaultPermissions
Set and get the default file creation mode permissions (in octal).
Public propertyDeleteOnFailure
Controls whether or not a file is deleted when a failure occurs.
(Inherited from SSHSCPClient.)
Public propertyDetectTransferMode
If set to true, the transfer mode in operations involving multiple files is automatically changed between ASCII and binary as appropriate.
(Overrides SSHSCPClientDetectTransferMode.)
Public propertyFilenameEncoding
The character-encoding to use for file and directory names.
Public propertyIsConnected
Indicates whether the client is currently connected with the server.
(Overrides SSHSCPClientIsConnected.)
Public propertyIsResuming
Returns true if the next transfer is to be resumed (i.e. Resume has been called).
(Inherited from SSHSCPClient.)
Public propertyKBIPrompts
Array of prompts used for keyboard interactive (KBI) authentication.
(Overrides SSHSCPClientKBIPrompts.)
Public propertyKnownHosts
Manager of the list of known hosts used to authenticate the server.
(Inherited from SSHSCPClient.)
Public propertyLastBytesTransferred
The number of bytes transferred in the last transfer operation.
(Inherited from SSHSCPClient.)
Public propertyLastFileTransferred
The remote name/path of the last file transferred.
(Inherited from SSHSCPClient.)
Public propertyLicenseKey
The license key string.
(Inherited from SSHSCPClient.)
Public propertyLicenseOwner
The license owner string.
(Inherited from SSHSCPClient.)
Public propertyLogTag
Log tag
(Inherited from SSHSCPClient.)
Public propertyMaxPacketSize
The SSH maximum packet size.
(Inherited from SSHSCPClient.)
Public propertyMaxQueuedReadRequests
Maximum number of read requests to queue up (1=no queuing).
Public propertyMaxTransferRate
The maximum transfer rate in bytes per sec
(Inherited from SSHSCPClient.)
Public propertyParallelTransferMode
Uploads are by default in parallel mode, which is faster than serial mode. This mode can be switched off if servers are unable to deal with parallel mode.
Public propertyPassword
Password of account on the server or the passphrase of the private key file.
(Inherited from SSHSCPClient.)
Public propertyPreferredCipherAlgorithms
Preferred algorithm(s) to use for encryption.
(Inherited from SSHSCPClient.)
Public propertyPreferredCompressionAlgorithms
Preferred algorithm(s) to use for data compression
(Inherited from SSHSCPClient.)
Public propertyPreferredHostKeyAlgorithms
Preferred algorithm(s) to use for server authentication via public key
(Inherited from SSHSCPClient.)
Public propertyPreferredKeyExchangeMethods
Preferred methods to use for key exchange.
(Inherited from SSHSCPClient.)
Public propertyPreferredMACAlgorithms
Preferred MAC algorithm(s)
(Inherited from SSHSCPClient.)
Public propertyProxySettings
Settings for using proxies.
(Inherited from SSHSCPClient.)
Public propertyRemoteHost
The domain-name or IP address of the SFTP server.
(Inherited from SSHSCPClient.)
Public propertyRetryAuth
By default, authentication is retried automatically using a different method if it fails.
(Inherited from SSHSCPClient.)
Public propertySendInitialWindowAdjust
Determines whether a SSH_MSG_CHANNEL_WINDOW_ADJUST message should be sent initially (true by default).
(Inherited from SSHSCPClient.)
Public propertyServerCompatibility
Controls various server compatibility features.
(Inherited from SSHSCPClient.)
Public propertyServerValidation
Controls the way in which remote servers are validated.
(Inherited from SSHSCPClient.)
Public propertyShowHiddenFiles
Include hidden files in operations that involve listing of directories, and if supported by the server. Not supported in SFTP.
(Inherited from SSHSCPClient.)
Public propertySleepEnabled
Enabling or not of sleeping after a certain number of transfers
Public propertySleepTime
Number of seconds spent asleep
Public propertyTCPBufferSize
The size of the TCP read and write buffers. The default value means the Microsoft defaults are used.
(Inherited from SSHSCPClient.)
Public propertyTimeout
Overall timeout in milliseconds for waiting for messages and underlying timeouts on sockets.
(Overrides SSHSCPClientTimeout.)
Public propertyTransferBufferSize
The size of the buffers (in bytes) used in writing to and reading from the data-sockets.
(Inherited from SSHSCPClient.)
Public propertyTransferNotifyInterval
The number of bytes transferred between each notification of the BytesTransferred event.
(Inherited from SSHSCPClient.)
Public propertyTransferNotifyListings
By default the BytesTransferred event is not triggered during directory listings - this property can be used to enable this behaviour.
(Inherited from SSHSCPClient.)
Public propertyTransferType
The current file transfer type (BINARY or ASCII).
(Overrides SSHSCPClientTransferType.)
Public propertyUMask
Set and get the umask, the file creation mode mask that is applied to the default permissions to create the final permission set.
Public propertyUserName
User-name of account on the server.
(Inherited from SSHSCPClient.)
Public propertyWelcomeMessage
Server's banner.
(Inherited from SSHSCPClient.)
Public propertyWindowSize
The SSH window size.
(Inherited from SSHSCPClient.)
Top
Methods
  NameDescription
Public methodCancelResume
Cancel the resume. Use this method if something goes wrong and the server is left in an inconsistent state. Not used in SCP as resume is not supported
(Inherited from SSHSCPClient.)
Public methodCancelTransfer
Cancels the current transfer.
(Inherited from SSHSCPClient.)
Public methodCdUp
Change the remote working directory to parent
(Overrides SSHSCPClientCdUp.)
Public methodChangeGroup
Public methodChangeOwner
Public methodChDir
Change the remote working directory
(Overrides SSHSCPClientChDir(String).)
Protected methodCheckConnection
Checks if the client has connected to the server and throws an exception if it hasn't. This is only intended to be used by subclasses
(Inherited from SSHSCPClient.)
Protected methodCheckTimeout
Check to see if the timeout has expired
(Inherited from SSHSCPClient.)
Public methodChMod
Changes the access permissions or modes of the specified file or directory.
Protected methodCloseSocket (Inherited from SSHSCPClient.)
Public methodConnect
Establish a connection to the SFTP server
(Overrides SSHSCPClientConnect.)
Public methodCreateSymbolicLink
Create a symbolic link on the server
Public methodDelete
Delete the specified remote file.
(Overrides SSHSCPClientDelete(String).)
Public methodDir
List current directory's contents as an array of strings of filenames.
(Overrides SSHSCPClientDir.)
Public methodDir(String)
List a directory's contents as an array of strings of filenames.
(Overrides SSHSCPClientDir(String).)
Public methodDir(String, Boolean)
List a directory's contents as an array of strings.
(Overrides SSHSCPClientDir(String, Boolean).)
Public methodDirDetails
List the current directory's contents as an array of FTPFile objects.
(Overrides SSHSCPClientDirDetails.)
Public methodDirDetails(String)
List a directory's contents as an array of FTPFile objects.
(Overrides SSHSCPClientDirDetails(String).)
Public methodDirDetails(String, FTPFileCallback) (Overrides SSHSCPClientDirDetails(String, FTPFileCallback).)
Public methodDirDetails(String, Boolean)
Returns the given directory's contents and optionally that of its subdirectories as an array of FTPFile objects.
(Overrides SSHSCPClientDirDetails(String, Boolean).)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExecuteCommand (Inherited from SSHSCPClient.)
Public methodExists
Checks for the existence of a file on the server.
(Overrides SSHSCPClientExists(String).)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGet(String)
Get data from the SFTP server.
(Inherited from SSHSCPClient.)
Public methodGet(Stream, String)
Get data from the server
(Inherited from SSHSCPClient.)
Public methodGet(String, String)
Get data from the SFTP server using the currently set transfer mode.
(Overrides SSHSCPClientGet(String, String).)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLocalCRC
Get the CRC-32 checksum for the named local file
(Inherited from SSHSCPClient.)
Public methodGetRemoteCRC
Get the CRC-32 checksum for the named remote file. Only supported with CompleteFTP.
(Overrides SSHSCPClientGetRemoteCRC(String, Int64, Int32).)
Public methodGetServerIdentity
Passes the software identity of the client to the server and returns the software identity of the server
Public methodGetSymbolicLinkTarget
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMkDir
Create the specified remote working directory.
(Overrides SSHSCPClientMkDir(String).)
Public methodModTime
Get modification time for a remote file.
(Overrides SSHSCPClientModTime(String).)
Public methodMultipleDelete(FileFilter)
Delete multiple files in the current remote directory
(Overrides SSHSCPClientMultipleDelete(FileFilter).)
Public methodMultipleDelete(String)
Delete multiple files in the current remote directory
(Overrides SSHSCPClientMultipleDelete(String).)
Public methodMultipleDelete(String, FileFilter, Boolean)
Delete multiple files in the current remote directory and its subdirectories.
(Overrides SSHSCPClientMultipleDelete(String, FileFilter, Boolean).)
Public methodMultipleDelete(String, String, Boolean)
Delete multiple files in the current remote directory and its subdirectories.
(Overrides SSHSCPClientMultipleDelete(String, String, Boolean).)
Public methodMultipleDeleteDirectories
Remove a remote directory, and all its files and its subdirectories
(Overrides SSHSCPClientMultipleDeleteDirectories(String).)
Public methodMultipleGet(String, FileFilter)
Get multiple files into the specified local directory from the current remote directory
(Overrides SSHSCPClientMultipleGet(String, FileFilter).)
Public methodMultipleGet(String, String)
Get multiple files into the specified local directory from the current remote directory
(Overrides SSHSCPClientMultipleGet(String, String).)
Public methodMultipleGet(String, String, FileFilter, Boolean)
Get multiple files from the specified remote directory into the specified local directory
(Overrides SSHSCPClientMultipleGet(String, String, FileFilter, Boolean).)
Public methodMultipleGet(String, String, String, Boolean)
Get multiple files from the specified remote directory into the specified local directory
(Overrides SSHSCPClientMultipleGet(String, String, String, Boolean).)
Public methodMultiplePut(String, FileFilter)
Put multiple files from the specified local directory into the current remote directory
(Overrides SSHSCPClientMultiplePut(String, FileFilter).)
Public methodMultiplePut(String, String)
Put multiple files from the specified local directory into the current remote directory
(Overrides SSHSCPClientMultiplePut(String, String).)
Public methodMultiplePut(String, String, FileFilter, Boolean)
Put multiple files from the specified local directory into the specified remote directory
(Overrides SSHSCPClientMultiplePut(String, String, FileFilter, Boolean).)
Public methodMultiplePut(String, String, String, Boolean)
Put multiple files from the specified local directory into the specified remote directory
(Overrides SSHSCPClientMultiplePut(String, String, String, Boolean).)
Protected methodOnBytesTransferred (Inherited from SSHSCPClient.)
Protected methodOnCommandSent (Inherited from SSHSCPClient.)
Protected methodOnReplyReceived (Inherited from SSHSCPClient.)
Protected methodOnTransferCancelled (Inherited from SSHSCPClient.)
Protected methodOnTransferCompleteEx (Inherited from SSHSCPClient.)
Protected methodOnTransferStartedEx (Inherited from SSHSCPClient.)
Public methodPut(Byte, String)
Put data onto the SFTP server in the current directory.
(Overrides SSHSCPClientPut(Byte, String).)
Public methodPut(Stream, String)
Put a stream of data onto the FTP server in the current directory.
(Overrides SSHSCPClientPut(Stream, String).)
Public methodPut(String, String)
Put a local file onto the SFTP server in the current directory.
(Overrides SSHSCPClientPut(String, String).)
Public methodPut(Byte, String, Boolean)
Put data onto the SFTP server in the current directory. Allows appending if current file exists.
(Overrides SSHSCPClientPut(Byte, String, Boolean).)
Public methodPut(Stream, String, Boolean)
Put a stream of data onto the FTP server in the current directory. Allows appending if current file exists
(Overrides SSHSCPClientPut(Stream, String, Boolean).)
Public methodPut(String, String, Boolean)
Upload a local file to the server
(Overrides SSHSCPClientPut(String, String, Boolean).)
Public methodPwd
Get the current remote working directory
(Overrides SSHSCPClientPwd.)
Public methodQuit
Quit the session
(Overrides SSHSCPClientQuit.)
Public methodQuitImmediately
Quit the session immediately. Just close the socket. Don't send any messages to the server.
(Overrides SSHSCPClientQuitImmediately.)
Public methodRename
Rename a remote file
(Overrides SSHSCPClientRename(String, String).)
Public methodResume
Make the next file transfer (put or get) resume.
(Overrides SSHSCPClientResume.)
Public methodResumeDownload
Make the next download resume at a specific point.
(Overrides SSHSCPClientResumeDownload(Int64).)
Public methodRmDir
Remove a directory
(Overrides SSHSCPClientRmDir(String).)
Public methodSetModTime
Set modification time for a remote file.
(Overrides SSHSCPClientSetModTime(String, DateTime).)
Public methodSize
Get the size of a remote file.
(Overrides SSHSCPClientSize(String).)
Public methodTestConnection
Tests the connection
(Overrides SSHSCPClientTestConnection.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUnlock
Unlock the software for use. This method should be used when a configuration file isn't available
(Inherited from SSHSCPClient.)
Top
Events
  NameDescription
Public eventBytesTransferred
Event triggered every time TransferNotifyInterval bytes transferred.
(Inherited from SSHSCPClient.)
Public eventCommandSent
Triggered every time a command is sent to the server.
(Inherited from SSHSCPClient.)
Public eventReplyReceived
Triggered every time a logical reply is received from the server. In SFTP this will NOT be triggered for every packet that arrives.
(Inherited from SSHSCPClient.)
Public eventTransferCancelled
Notifies of the cancellation of a transfer
(Inherited from SSHSCPClient.)
Public eventTransferCompleteEx
Notifies of the completion of a transfer
(Inherited from SSHSCPClient.)
Public eventTransferStartedEx
Notifies of the start of a transfer
(Inherited from SSHSCPClient.)
Public eventValidatingServer
Notifies that the server must be validated
(Inherited from SSHSCPClient.)
Top
Fields
  NameDescription
Protected field_proxySettings
Proxy settings
(Inherited from SSHSCPClient.)
Protected fieldcancelTransfer
Can be used to cancel a transfer
(Inherited from SSHSCPClient.)
Protected fieldcloseStreamsAfterTransfer
If true then streams are closed after a transfer has completed.
(Inherited from SSHSCPClient.)
Protected fieldcompatFlags
Configuration flags for non-compliant servers
(Inherited from SSHSCPClient.)
Protected fieldcompressionAlg
Compression algorithms
(Inherited from SSHSCPClient.)
Protected fieldcontrolPort (Inherited from SSHSCPClient.)
Protected fieldcwd
Current remote working directory
(Inherited from SSHSCPClient.)
Public fieldStatic memberDEFAULT_PERMISSIONS
Default value of umask.
Public fieldStatic memberDEFAULT_UMASK
Default value of umask.
Protected fielddeleteOnFailure
If a download to a file fails, delete the partial file
(Inherited from SSHSCPClient.)
Protected fielddetectTransferMode
Do we detect transfer mode when transferring files?
(Inherited from SSHSCPClient.)
Protected fieldkey
License key
(Inherited from SSHSCPClient.)
Protected fieldknownHostsManager
Manages the list of known hosts
(Inherited from SSHSCPClient.)
Protected fieldlastBytesTransferred
Holds the number of bytes transferred in that most recent transfer.
(Inherited from SSHSCPClient.)
Protected fieldlastFileTransferred
Name of the last file transferred.
(Inherited from SSHSCPClient.)
Protected fieldlogTag
Logging tag
(Inherited from SSHSCPClient.)
Protected fieldmonitorInterval
Bytes transferred in between monitor callbacks
(Inherited from SSHSCPClient.)
Protected fieldowner
License owner
(Inherited from SSHSCPClient.)
Protected fieldprompts
List of authorization prompts
(Inherited from SSHSCPClient.)
Protected fieldremoteHost
Remote host we are connecting to
(Inherited from SSHSCPClient.)
Protected fieldremoteIPAddress
IP address of remote host in string form
(Inherited from SSHSCPClient.)
Protected fieldresume
If true, a file transfer is being resumed
(Inherited from SSHSCPClient.)
Protected fieldserverValidation
Determines how the remote host is validated
(Inherited from SSHSCPClient.)
Protected fieldsocket (Inherited from SSHSCPClient.)
Protected fieldsocks
SOCKS settings
(Inherited from SSHSCPClient.)
Protected fieldtcpBufferSize
The TCP read and write buffer sizes
(Inherited from SSHSCPClient.)
Protected fieldthrottler
Threshold for throttling
(Inherited from SSHSCPClient.)
Protected fieldtimeout
Timeout in milliseconds
(Inherited from SSHSCPClient.)
Protected fieldtransferBufferSize
Size of transfer buffers
(Inherited from SSHSCPClient.)
Protected fieldtransferNotifyListings
Should BytesTransferred event be triggered in directory listings?
(Inherited from SSHSCPClient.)
Protected fieldtransferType
Record of the transfer type - make the default BINARY
(Inherited from SSHSCPClient.)
Top
Remarks

SSHFTPClient supports SOCKS (4, 4A, and 5) and SFTP.

SSHFTPClient supports SFTP, which stands for SSH File Transfer Protocol. Essentially, it is file transfer over an SSH connection, hence it has the security of SSH. SFTP is only superficially related to FTP and FTPS. It achieves the same goals of file transfer and related operations, but the underlying protocol is entirely different.

Examples
This example shows a simple SFTP session.
// create an SFTP client
SSHFTPClient ftp = new SSHFTPClient();
ftp.RemoteHost = "192.168.10.123";

// Turn off server validation (ONLY do this when testing)
ftp.ServerValidation = SecureFTPServerValidationType.None;

// set up the credentials for password authentication (the default)
ftp.UserName = "myuser";
ftp.Password = "mypassword";

// connect to the server
ftp.Connect();                        

// get a file
ftp.Get("file.txt", "file.txt");

// close the connection
ftp.Quit();

This example uses password authentication and does not attempt to verify the server (which should always be done in production systems).

Server Validation: The examples above used no server validation. This is only normally acceptable only when testing. To be secure applications should always validate the server that they're communicating with. If the [!:ServerValidation] property is set to SecureFTPServerValidationType.Automatic or SecureFTPServerValidationType.AutomaticIgnoreHostName then SSHFTPClient will attempt to validate the server's public key upon connection.

Public keys are managed by the KnownHostsManager, available in the [!:KnownHosts] property. There are two ways that the client can load server public keys - via the known_hosts file or by explicitly loading a public key from a file.

  1. Known_hosts - Many SSH implementations use a file called known_hosts which is loaded by clients to validate servers. Typically, this file is generated when the client first connects to a server - a prompt asks if the server should be added to the list of known hosts. The known_hosts file contains a list of approved servers and their public keys. The KnownHostsManager has a property called KnownHostsFile. The path of the known_hosts file should be assigned to this property to load the known hosts in that file.
  2. Public key files - Server public keys can also be maintained in their own key file and be used for server validation without adding them to the known_hosts file. The KnownHostsManager supports explicitly adding server public keys via the AddKnownHost(String, String) method. This requires the hostname and the public key file. SSH public key files have two standard formats - OpenSSH and SECSH. Both these public key formats are supported.

Client Validation: Client authentication can be either by password, by public/private keys, or by keyboard- interactive authentication. The default is password authentication. The current authentication method can be found (and set) from the [!:AuthenticationMethod] property.

  1. Password authentication - In password authentication, the [!:UserName] and [!:Password] properties must be set, along with the ServerAddress. The user name and password should be that of the SSH user that the client is logging in as. Note that some SFTP servers are set up to disallow password authentication, in which case the connection attempt will fail unless password authentication is enabled in the server configuration file.
  2. Public key authentication - In public key authentication, SSH clients and servers authenticate each other via public/private key pairs. Each must have access to their own private key, and they must have access to each other's public key. The client's public key must be registered with the SSH server, typically by copying it into the server's authorized_keys file. The client's private key is loaded via the [!:ClientPrivateKeyFile] property. Both DSA and RSA keypairs can be used. The [!:UserName] and [!:Password] properties must be set, along with the [!:RemoteHost]. Here the password is the passphrase of the private key file. The [!:AuthenticationMethod] property must also be set to PublicKey. There are no formal standards for SSH private key files, however two main formats are in common use - ssh.com and OpenSSH. Both are supported.
  3. Keyboard-interactive authentication - Keyboard-interactive (KBI) authentication is the most recently introduced form of authentication for SSH. It involves the server sending prompts to the client, which the client must respond to correctly to be authenticated. Its purpose is permit the client to support a variety of authentication mechanisms without knowing anything about them. This implementation of KBI authentication relies on the programmer knowing the prompts in advance. The prompts are easily determined by connecting to the server via a command-line ssh client, using KBI. when the server sends its list of prompts that require responses, the client searches the list of loaded SSHAuthPrompts for each prompt. It then sends the set responses back to the server. If the expected responses are supplied, the authentication succeeds. If the prompt is for a user's password, it will typically be something like "Password:". The SSHPasswordPrompt class is supplied to make it easier to set up a password prompt. To set up the prompts, an array of SSHAuthPrompts is assigned to the KBIPrompts property. Note that to use KBI, the [!:AuthenticationMethod] property must also be set to KeyboardInteractive.

Server Compatibility: Generally, this class should work with most SFTP servers. Some servers return an error saying the file does not exist after creating it. By default, the client does a permission change after creating the file, which is done to ensure the file permissions are correct. If this error is encountered, try setting the [!:ServerCompatibility] property to SSHDisableChmodAfterPut to try to eliminate the problem.

Public key algorithms: Either DSA or RSA or both can be set for the preferred public key algorithms for server authentication. If, for example, RSA is set, the server will present an RSA public key to the client (if the server supports RSA keys of course - some servers do not). The [!:PreferredHostKeyAlgorithms] property is a bitwise flag and can be set to combinations of the SSHPublicKeyAlgorithm enum values by OR'ing them together. The default is all algorithms enabled.

Cipher algorithms: The cipher algorithms are the symmetric algorithms used to perform the encryption of the SFTP data and commands. The [!:PreferredCipherAlgorithms] property is a bitwise flag and can be set to combinations of the SSHCipherAlgorithm enum values by OR'ing them together. The default is all algorithms enabled.

SOCKS: SOCKS may be used for FTPing through firewalls. For this to be possible a SOCKS proxy must be available, and a user account must be set up on that proxy. SSLFTPClient supports all the popular versions of SOCKS - 4, 4A, and 5.

The SOCKS features are controlled entirely through the SocksContext property. If it is null (the default) then SOCKS is not used. To use SOCKS, the property must be set to an instance of Socks4Context or Socks5Context. For example, for SOCKS4:

myFTPClient.SocksContext = new Socks4Context("192.168.0.2", 1080, "marvin23");
and for SOCKS5:
Socks5Context socksContext = new Socks5Context("192.168.0.2", 1080);
socksContext.AuthMethods.Add(new Socks5NoAuthMethod());
socksContext.AuthMethods.Add(new Socks5UserNamePasswordAuthMethod("marvin23", "m31erk"));
myFTPClient.SocksContext = socksContext;
See Also