[jcifs] credentials while accessing the file on localhost

eglass1 at comcast.net eglass1 at comcast.net
Mon Mar 1 10:30:15 GMT 2004


> 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