Custom FTP proxy

0 votes
asked Jun 15, 2012 by Michel van den Berg (120 points)
edited Aug 18, 2016 by Lukas Pokorny

I'm unable to connect to an FTP server with the following custom FTP proxy:

USER %u@%h %s

Do you support this?

Applies to: Rebex FTP/SSL

3 Answers

0 votes
answered Jun 15, 2012 by Jan Sotola (17,670 points)
edited Jun 18, 2012

There is no pre-defined proxy type in the FtpProxyType enumeration.

However, if you need to connect through proxy using exactly the mentioned syntax

USER %username@%host %proxyUser
PASS %password
ACCT %proxyPassword

you can do it with the following code:

Ftp ftp = new Ftp();
string username = ""; 
string password = ""; 
string host = "";
string proxyUser = "bob.kent"; 
string proxyPassword = "*****"; 
string proxyHost = "";
ftp.Login(username + "@" + host + " " + proxyUser, password, proxyPassword);

Note: no setting of the ftp.Proxy property is needed in this situation.

commented Jun 18, 2012 by Michel van den Berg (120 points)
edited Jun 18, 2012

This works! The proxy credentials are the same as the windows credentials... is there any way I can pass these along so that I don't have to ask the user for the proxy credentials?

commented Jun 18, 2012 by Jan Sotola (17,670 points)
edited Jun 18, 2012

I think it is not possible, but I'd like to consult it with my colleague tomorrow. Than I'll write you the final answer.

commented Jan 15, 2016 by anonymous
edited Jan 18, 2016 by anonymous
i have the same custom proxy settings but the code above doesn't work for me -.-

i have to set proxy settings ( proxytype = FtpUser and host ). otherwise i can't connect to the ftp server and this exception comes up: No connection could be made because the target machine actively refused it.

when connected, the code above does not work throwing the exception "ACCT proxypassword (530)".
(username, password and host were not empty).

who can help me?

- my fault... i connected to the ftp instead of proxy -.-
commented Jan 18, 2016 by Lukas Matyska (61,230 points)
Great, that you solved the issue.
commented Jan 29, 2016 by anonymous
having the same proxy custom settings, how to connect to a SFTP server and especially login?  the login method for sftp does not provide parameters: @username @pw, @account.

thank you in advance!
commented Jan 29, 2016 by Lukas Matyska (61,230 points)
Actually, this is not possible with SFTP, unless your proxy supports SSH. From the syntax of your proxy, it doesn't seem that the proxy supports it.

Maybe you are trying to use FTPS (which is rather called FTP/SSL) instead of SFTP?  To understand differences see

However, in that case, the proxy have to support SSL. If not, there is no need to use any secured protocol, because the password from your proxy to the remote host is sent in plaintext.
0 votes
answered Jun 19, 2012 by Lukas Pokorny (128,250 points)
edited Jun 19, 2012

Unfortunately, Jan is right - this is not possible. Essentially, you would need a way to retrieve the current user's username and password, which is not possible for security reasons.

As far as I know, the only way to re-use Windows credentials is using NTLM or Kerberos authentication (both support single-sign-on, sometimes refered to as Windows integrated authentication) and none of them applies here (unless you switch to an HTTP CONNECT proxy).

0 votes
answered Aug 18, 2016 by JohnBonem (140 points)
edited Aug 22, 2016 by Tomas Knopp

Hello. Have the same question. How can i connect to the remote ftp server, using proxy from ?

commented Aug 18, 2016 by Lukas Pokorny (128,250 points)
They seem to offer proxies that support multiple protocols at once and recommend using SOCKS5 (see To connect to a SOCKS5 proxy using Rebex FTP/SSL, use the following code:

    var ftp = new Ftp();
    ftp.Proxy.ProxyType = FtpProxyType.Socks5;
    ftp.Proxy.Host = ""; // replace with proxy address
    ftp.Proxy.Port = 1080; // replace with proxy port
    //ftp.Proxy.UserName = "user01"; // use your user name
    //ftp.Proxy.Password = "password"; // use your password

    ftp.Connect("", SslMode.Explicit); // use the desired host name and SSL mode

However, I have been unable to try this with their free proxies - most of them seem to prohibit FTP (see the note at the end of