[jcifs] Problems authenticating to Mac OS X server

Michael B Allen ioplex at gmail.com
Thu Nov 20 19:50:24 MST 2014


On Tue, Nov 11, 2014 at 7:12 PM, Trejkaz <trejkaz at trypticon.org> wrote:
> Hi all.
>
> I wrote a test program which was eventually supposed to time file transfers
> with jCIFS so that I could compare it with HTTP clients.
>
> The test program is pretty simple (but as I haven't been able to connect yet,
> I'm not confident that it's correct):
>
>     import jcifs.smb.NtlmPasswordAuthentication;
>     import jcifs.smb.SmbFile;
>
>     public class TestCifs {
>         public static void main(String[] args) throws Exception {
>             String domain = ""; // have tried the actual name too
>             String user = "<your_user_here>";
>             String pass = "<your_pass_here>";
>             String host = "192.168.1.66";
>             String share = "Shared";
>             String relativePath = "path/to/100MiB";
>
>             //TODO: Figure out if this is a real URL (for escaping)
>             NtlmPasswordAuthentication auth =
>                 new NtlmPasswordAuthentication(domain, user, pass);
>             String url = String.format("smb://%s/%s/%s", host, share,
>                                        relativePath);
>             SmbFile smbFile = new SmbFile(url, auth);
>             smbFile.getInputStream().close();
>         }
>     }
>
> When I run this, I get an error:
>
>     Exception in thread "main" jcifs.smb.SmbAuthException: Logon failure:
>             unknown user name or bad password.
>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:596)
>         at jcifs.smb.SmbTransport.send(SmbTransport.java:722)
>         at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:428)

Hi Trejkaz,

Try the machine name for the domain.

Also try using a fully qualified DNS hostname instead of the IP.

I'm not aware of mac having an issue like this. It should work. The
SESSION_SETUP_ANDX in your capture is perfectly valid. For some reason
I would not be surprised if mac were fickle about something like an
empty domain. That would be a special case that the server would have
to consider (by mapping it to the local machine domain).

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jCIFS mailing list