简体   繁体   中英

How to protect certain files on a network drive from direct user manipulation while allowing manipulation through my Java program?

I've written a medium-sized Java program for an exporting company. I want to limit the employees' ability to edit some files (such as a Sales Contract Log) to only the Java application's user interface. If I change the file permissions, then I assume the Java application cannot edit the files either (as the application would be run from the current user).

As one specific example, how can I allow the Java program to alter information on a log text file without allowing the user to simply open the text file and edit it however they want?

I think you can run the jar as another user. In this way users are logged with their user, but program run as different one. Then you have to change permission of file.

Check this link to see how to run the jar as different user launch .jar as a different user . In this link the example is with admin, but you can apply to a different user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM