[jcifs] SmbFile: logon to Workgroup PC share fails

Michael B Allen ioplex at gmail.com
Wed Dec 16 10:10:21 MST 2009

Hi Jean-Marc,

You should be able to login using a stand-alone machine using a local
account. The domain is the machine name. It should work. It could be
that the "Login failure" is for something else like domain based DFS.
Perhaps try setting jcifs.smb.client.dfs.disabled = true.


On Wed, Dec 16, 2009 at 10:56 AM, Jean-Marc Autexier <jmau2002 at web.de> wrote:
> Hi,
> I'm trying to access a share on a workgroup PC which is NOT in my domain. The logon fails.
> Sample code:
> NtlmPasswordAuthentication ntlmauth = new NtlmPasswordAuthentication("MYWORKGROUP","MyUser","password");
> SmbFile to1 = new SmbFile( "smb://serverIP/share/filename.txt", ntlmauth);
> System.out.println("Exist: "+to1.exists());
> In exist() I get the following error:
> Exception in thread "main" jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password.
>        at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:375)
>        at jcifs.smb.SmbSession.send(SmbSession.java:217)
>        at jcifs.smb.SmbTree.treeConnect(SmbTree.java:161)
>        at jcifs.smb.SmbFile.doConnect(SmbFile.java:899)
>        at jcifs.smb.SmbFile.connect(SmbFile.java:942)
>        at jcifs.smb.SmbFile.connect0(SmbFile.java:868)
>        at jcifs.smb.SmbFile.exists(SmbFile.java:1401)
> Accessing the share with Windows explorer using MYWORKGROUP, MyUser and password works.
> Instead of MYWORKGROUP I tried to use the hostname, didn't work either.
> Question: can I connect to a share on a Workgroup PC with jcifs?
> If yes, what's wrong with my code?
> Tx,
> Jean-Marc
> ___________________________________________________________
> Preisknaller: WEB.DE DSL Flatrate für nur 16,99 Euro/mtl.!
> http://produkte.web.de/go/02/

Michael B Allen
Java Active Directory Integration

More information about the jCIFS mailing list