[jcifs] credentials while accessing the file on localhost

Michael B Allen mba2000 at ioplex.com
Thu Feb 19 19:41:11 GMT 2004


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