简体   繁体   中英

jCIFS can´t authenticate on Mac server

I´ve set up a samba server on a Mac with OS X El Capitan.

Then, configured my java project to access this server using jCifs library but I get this error:

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

My code is:

NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("domain","username","password");
String path = "smb://ip/filepath";
SmbFile file = new SmbFile(path, auth);

The username I used is the owner of the account in which I set up the server in the Mac and the password is correct.

I tried to access from another Mac and from an android device, both in the same network. I Also tried creating another user account in the server, with no luck.

In google, most of the cases belong to other OS. Besides that, my configuration seems fine.

Any idea? Thanks in advance.

After a deeper research, I found a post in which is told that the smb protocol implementation seems to be broken in OS X (link here: http://www.tweaking4all.com/os-tips-and-tricks/macosx-tips-and-tricks/smbup-mac-os-x-smb-fix/ ).

The server was set up using the configuration tool provided by the operating system so I tried to reconfigure the server with the same settings than before using other tool (SMBUp) and now I can connect without any problem without having changed the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM