Connecting to a SOCKS5 proxy to do FTP/S in Java – Education Career Blog

I’m writing a job that will connect to a client’s FTP/S server over my SOCKS5 proxy and I’m utilizing the Apache Commons Net package. The issue is that my SOCKS proxy is configured to not require authentication but I am still getting the following exception: SOCKS : authentication failed

I’ve tried setting the and password properties to empty strings but I still get it. Is there a way I can tell the code to not use authentication? Digging into the underlying source i almost think it’s querying the proxy server for the authentication requirement, but I’m not sure.


Alright so the issue was that my SOCKS proxy was set up to ask for authentication but to also accept connections that did not authenticate. We use Dante and while programs like Filezilla are smart enough to iterate through all of the acceptable authentication methods, it seems like the package only goes off the first method supplied. Since my authentication configuration in my sockd.conf file was as follows:

method: username none
user.notprivileged: nobody was demanding a username and password. I simply flipped the methods to “none username” and both Filezilla and correctly pass through the proxy. It’s a bit of an IT solution but whatever gets the code to work, right?

Leave a Comment