1

I would like to know if there is any way for Java to prompt the user for the administrative password, like what they would use with sudo, so that I can run commands in the Java program without having to do weird stuff with the system or Sudoers. I have seen in done in Python, ie with the program gufw, and I would like to be able to do it with Java.

1

1 Answer 1

0

To act as gufw you must use polkit along with dbus-java. Another possibly simpler solution is to build a command (e.g. "sudo command" and run it with Runtime.getRuntime().exec Doing this can be very dangerous must be done carefully.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.