[jcifs] credentials while accessing the file on localhost

Naved Khan navedk at cybage.com
Thu Feb 19 12:20:23 GMT 2004


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?

Thanks,
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: Thursday, February 19, 2004 3:30 PM
Subject: Re: [jcifs] credentials while accessing the file on localhost


> Naved Khan said:
> > Is there a way I can access the files on the same/remote machine w/o
> > providing the credentials.
>
> No. It's not clear to me how one would setup a server to not attempt
> authentication at all.
>
> But jCIFS will attempt to use the "GUEST" account by default. Also you can
> use empty credentials with a username and password of "" like:
>
> smb://:@server/share/path/to/file.txt
>
> Mike
>



More information about the jcifs mailing list