[jcifs] credentials while accessing the file on localhost

Naved Khan navedk at cybage.com
Mon Mar 1 06:12:21 GMT 2004


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 I
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 even
while accessing a local shared folder? Or am I missing something here?
Please clarify.

Thanks and regards,
Naved



----- Original Message ----- 
From: "Michael B Allen" <mba2000 at ioplex.com>
To: "Naved Khan" <navedk at cybage.com>
Cc: <jcifs at lists.samba.org>
Sent: Friday, February 20, 2004 1:11 AM
Subject: Re: [jcifs] credentials while accessing the file on localhost


> Naved Khan said:
> > like I mentioned, in my case the source machine can either be a
localhost
> > or
> > a remote machine...for remote machine, the authentication is required.
But
> > for the localhost, credentials need not be given.
> >
> > the following code gives a SMBAuthException if user/password is left
> > blank.
> >
> > SmbFile smbFile = new SmbFile("smb://:@naved/shared_folder/test.dat");
> > if(smbFile.exists()) {
> > ...
> > }
> > "naved" is my machine name. For local files I can simply use java io,
but
> > wanted to know if I can use SmbFile for code uniformity?
>
> No, jCIFS only performs the CIFS protocol. It does not behave selectively
> depending on wheather or not the host is remote or local (although Windows
> servers tend to behave differently to clients that happen to be on the
> localhost).
>
> Mike



More information about the jcifs mailing list