How to prevent users from closing my executable(exe) application using task manager despite of their privileges?
I usually use Lunch4j to convert my excecutable jar file to .exe
file, but alt+f4
is enough to close the program.
My question is, is there any thing, programmatically in java before wrapping as exe
, or after that in system configurations, that I can do to make it unclosable "access denied" or to mark the application as a system service if that is useful in this case?
Thank you
Generally speaking, there's no way to stop your process from being terminated by a user with permission to do so.
So, if the user is not an administrator it would suffice to run the process in a different user context (eg run it as a service).
As mentioned in this article "you can not, and should not, attempt to stop an Administrator from killing your process or stopping your service".
That being said, you can adjust your process’ access control list to prevent users from killing it.
It is a good practice to explicitly give the necessary rights and not let everybody (user or application) have administrative rights in your system.
Using this practice you can easily prevent nearly everyone from terminating your process.
You can find here more information about the Microsoft Windows security model and options about securing your application against the world.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With