jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password.

Sin5k4 picture Sin5k4 · Jul 9, 2012 · Viewed 29.5k times · Source

planning to read a file over a Windows from Ubuntu in Java using jcifs.Tried a simple approach using:

String user = "mydomain;myuser:mypassword";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user);
SmbFile remotefile = new SmbFile("smb://myserver/myfolder/myfile.jar",auth);

Knowing that the server works and the login values are correct,all i get is a logon failure,what could be the problem here?

Answer

peterb picture peterb · Nov 4, 2012

Not sure if you got this to work. But after much pain and anguish, I figured the NtlmPasswordAuthentication call must include the domain. So if you're using the code @user717630 posted, you'll just have to change the NtlmPasswordAuthentication call to: NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("mydomain",user, pass);