[jcifs] credentials while accessing the file on localhost

Naved Khan navedk at cybage.com
Mon Mar 1 07:34:46 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.


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

> Naved Khan said:
> > Sorry to continue this thread. I'm not quite getting why I need the
> > username/password to access a shared folder on my local machine...why do
> > get "access denied" when I try to access a shared file in the following
> > way:
> > // naved - local machine
> > SmbFile smbFile = new SmbFile("smb://naved/shared/test.dat");
> > boolean exists = smbFile.exists();
> >
> > However I can access the same folder without providing username/password
> > either through windows explorer or using net use.
> >
> > Is it that we always have to provide the username/password in SmbFile
> > while accessing a local shared folder? Or am I missing something here?
> > Please clarify.
> JCIFS makes no distinction between a local or remove SMB resource.
> If credentials are not supplied the client will use the user "GUEST"
> without a password.
> Have you tried smb://user:@server, smb://:@server, smb://user@server, ...?
> Do you use a username to log into your machine?
> What happens if you set your password and use that with JCIFS?
> Mike

More information about the jcifs mailing list