[jcifs] credentials while accessing the file on localhost
navedk at cybage.com
Tue Mar 2 06:31:25 GMT 2004
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?
----- 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
> > 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
> > 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).
> when you log in Windows remembers the username and password entered and
> 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
> the GUEST account (as Mike noted), which would typically have
> restricted access (if it is even enabled).
More information about the jcifs