Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to windows share using hostname but works with IP address #363

Open
harikrishnanmurthy opened this issue Nov 6, 2024 · 1 comment

Comments

@harikrishnanmurthy
Copy link

harikrishnanmurthy commented Nov 6, 2024

Hi,
I have a windows share that looks like this:
//insurance_share/datadfs

When I try to connect to this windows share using the hostname above, I get a "Failed to connect to server" error. When I inspected the properties of this windows share, under DFS, it has a number of referral paths. When I use the hostname of one of these DFS, then the connection works.

When I did a ping in command line, I could get their IP address and the connection works using IP address.

Am I required to set any property in order to connect to the windows share using the original name (//insurance_share/datadfs) instead of relying on the DFS referral path or IP address?
My configuration looks like this:

	Properties jcifsProperties = new Properties();
	jcifsProperties.setProperty("jcifs.smb.client.minVersion", "SMB311"); //tried with 202 also 
	jcifsProperties.setProperty("jcifs.smb.client.maxVersion","SMB311");  // tried with 202 also
	Configuration config = new PropertyConfiguration(jcifsProperties);
	BaseContext baseCxt = new BaseContext(config);
	NtlmPasswordAuthenticator auth = new NtlmPasswordAuthenticator(null, smbShareUser, smbSharePass);
	CIFSContext authed = baseCxt.withCredentials(auth);

Any help would be much appreciated 🙏
P.S:
The machine type is windows 2016 server
And the version of jcifs-ng I use is 2.1.9

@mbechler
Copy link
Contributor

mbechler commented Nov 7, 2024

For jcifs's domain DFS lookups to work you need to provide the domain name in NtlmPasswordAuthenticator. That may be the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants