1

I have a project to do for my master's degree and I need to do a Java app which loads a file (read some attributes and copy the file to a working directory), basically any file, and make the working directory private. By private I mean to hide that directory in a way from any OS (well, basically Windows and Linux). I'm not sure that the OS (Windows and Linux) functions to hide directories work because an admin/superuser can modify those settings and easily access my files.

The idea for the project is to have exclusive access to those loaded files from within the app and to make them available for the applications installed locally to open/run them (like "Open in media player"), which should work also when I copy the app to a USB stick.

I have 2 options:
1. modify each file after loading to make unreadable to the world and undo the modifications each time I press "Open" from within the app;
2. (which I think is the best and most simple option) Modify the root directory of those files (root = the working directory or some subdirectory of it) to be unreadable/unaccessible to the world while outside the app and readable to the app at runtime.

I've been thinking about something like making a locally encrypted copy of filesystem attributes of the directory, "delete" them while not at app runtime and put them back while at app runtime. But I haven't really played with this before and also Windows & Linux filesystem aren't simple at all. More of it, a USB stick has a FAT filesystem (which if I'm not wrong "belongs" to DOS), which is, yeah, another filesystem into the equation.

I'm almost sure it is not feasible (and not secure!) to simply play back and forth with the filesystem at my pleasure, so I need some ideas to find that breakthrough without actually breaking anything.

  • By hiding the directory from any OS do you mean the OS running the program as well? In other words are you creating an application based file system unavailable to the running OS? – zedman9991 Jul 7 '15 at 15:20
  • Nice question. No, just hiding it from the user and making it readable to the OS only by executing the app. By using locally installed programs to run the files, there is that "recently opened files" feature, which I should also trick. – Ionescu Alexandru Jul 7 '15 at 15:27
  • Are the "applications installed locally" all other apps you create/control or do they need to be any other app on the system? If it's the latter then your whole premise is shot, you simply can't do it, even superficially. – Jeff Meden Jul 8 '15 at 15:16
2

One trick you can use in Linux is to create a file, keep the pointer/handler and delete it immediately. You can then use your file's handle to write and read to it. Linux won't show the file to nobody because you removed it from the OS's file table. Unfortunately you would have to write back the file in a "normal" file when you program closes since you did delete the file. This method is usually used to create temporary files for programs.

As for windows I don't see how you can manage that.

Hope that helps a little.

| improve this answer | |
  • I think the solution is to create a filesystem on my own, mount it at the runtime of my app and manage the things like that. Found an interesting jimfs library from Google – Ionescu Alexandru Jul 10 '15 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.