[jcifs] credentials while accessing the file on localhost

Naved Khan navedk at cybage.com
Tue Mar 2 06:31:25 GMT 2004


Hi,

I enabled the guest account on my machine (win 2k) and gave it access to the
shared folder. (My machine belongs to a domain.)

Even after this, I get the "access denied" failure when I use the SmbFile to
access the shared folder.

SmbFile smbFile = new SmbFile("smb://naved/shared/test.dat");
boolean exists = smbFile.exists();

I tried the other combinations too (smb://user:@server, smb://:@server etc).
None of them work. Shouldn't it implicitly use the guest anonymous login?

Thanks,
Naved

----- Original Message ----- 
From: <eglass1 at comcast.net>
To: "Naved Khan" <navedk at cybage.com>
Cc: "Michael B Allen" <mba2000 at ioplex.com>; <jcifs at lists.samba.org>
Sent: Monday, March 01, 2004 4:00 PM
Subject: Re: [jcifs] credentials while accessing the file on localhost


> > I tried using smb://user:@server, smb://:@server, smb://user@server and
> > smb://server/shared/.  All give me the "Access denied" exception.
> > Yes I use a username/password to login to my win 2000 machine. When I
set
> > the username and password either in the smb url string or in the
> > jcifs.smb.client properties, it works fine. But my requirement was to
access
> > shared folders using anonymous login (for shares that do not require
> > user/pwd like local shares).
> > I can use net use successfully without providing any credentials though:
> > C:\>net use \\naved\shared
> > The command completed successfully.
> >
>
> Windows (explorer, etc.) will use the cached credentials of the currently
> logged in user (when accessing either remote or local shares).
Effectively,
> when you log in Windows remembers the username and password entered and
uses
> that for subsequent authentications.  This is why you don't get prompted
> to enter a password later.  jCIFS can't use the cached credentials, which
> is why you need to enter a username/password.  If you don't, jCIFS will
use
> the GUEST account (as Mike noted), which would typically have
significantly
> restricted access (if it is even enabled).
>
> Eric
>



More information about the jcifs mailing list