This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Security and the fly likes Reading/writing files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Reading/writing files" Watch "Reading/writing files" New topic

Reading/writing files

Ash Jagtap

Joined: Mar 20, 2009
Posts: 1
I have requirement where I wanted to upload/download file on [b]Data Ontap[/b].
Below is the description:

The machine on which file has to upload/download is operating system using it`s own OS Data Ontap 7.0.4p.
It is Not using NFS service on the filer , it is using [b]CIFS service.[/b]
NTFS is used to control User previledges.

As of now the code is able to read/write files from a shared folder on this system. This is a simple File IO code. But the moment the access to this shared folder is given only to a specific user id, the code fails.

Can it be possible to use core java Api that will allow us to change the previleges/credentials of the thread that is executing the file io.If yes which is that API?Will JAAS suffice?How?
Else which API can be used for the above problem solution.

Resposne will be appreciated as this problem has taken lot time.
Carey Evans
Ranch Hand

Joined: May 27, 2008
Posts: 225

You can't change thread credentials in Java using standard APIs. The simplest way to access the files as another user may be to use JCIFS instead of the package.
I agree. Here's the link:
subject: Reading/writing files
Similar Threads
Accesing Files stored on remote server by using Credentials
upload and download file to any machine in a n/w
Commons FileUpload
Need Help for implementing save as dialog box for downloading a folder not a file
Cancelling a file download - "java.lang.IllegalStateException: getOutputStream() ..."