开发者

Possible to lock down directory so only single appdomain can access it

开发者 https://www.devze.com 2023-02-07 04:50 出处:网络
Is it possible to lock down a directory in windows and on linux (for mono access) where only a single application/user can get access to it?

Is it possible to lock down a directory in windows and on linux (for mono access) where only a single application/user can get access to it?

I need to write encrypted XML messages into a directory but don't want anybody deleting them. I suspect it would be easier using Mono on linux.

If it's possible, what are the classes you would use, to check to ensure it开发者_StackOverflow is locked down before you started writing to it.

Thanks.


Assuming your directories are on an NTFS filesystem, you could use NTFS as outlined here, or native syscall from Mono as outlined here. The tricky bit would be that code in each AppDomain would need to be running as it's own user.

I'd think it would be simpler to lock down the parent directory using whatever permissioning system is supported by your filesystem so that users cannot manually delete these files, but the application's user can create and read them, and then ensure that the program logic does not allow for an AppDomain to step on another's files.

If you are just looking for synchronization (meaning that you don't want multiple threads accessing the same files at the same time), you could just use a central registry (a database table, or some other transactional store) to keep track of who is writing to what.

0

精彩评论

暂无评论...
验证码 换一张
取 消