[jcifs] How to secure authentication and data transfer
eric.glass at gmail.com
Wed Mar 21 09:42:47 GMT 2007
> I want to access several file servers over CIFS from a WebSphere Application
> Server. The authentication is done by the following lines.
> Config.setProperty("jcifs.smb.client.domain", "ad.test");
> Config.setProperty("jcifs.smb.client.username", "user");
> Config.setProperty("jcifs.smb.client.password", "pw");
> Config.setProperty("jcifs.resolveOrder", "DNS,WINS");
The above would actually just configure the jCIFS library for
subsequent operations; i.e. it indicates that when a future connection
is established by jCIFS, it should use the specified domain, username,
and password to connect (and use DNS, followed by WINS, to resolve
hostnames; although if you don't specify a WINS server the latter will
likely not work properly). For the domain, you would typically
specify the NT-style "NetBIOS" domain name.
To then connect and transfer data you would do something like:
SmbFile file = new SmbFile("smb://cifsserver/share/directory/file.txt");
InputStream input = file.getInputStream();
This will make the connection to "cifsserver" using the specified
credentials and transfer the file.
More information about the jcifs