Is there any way i can restart my computer running Ubuntu 13.04 using a Java application without needing any sudo rights?
Asked
Active
Viewed 897 times
2
-
Is there a way to restart the computer at all without super user rights? – user2759991 Oct 12 '13 at 00:36
-
I am not sure,most probably no, thats why i asked the question here so that if there is any way – Muhammad Omer Oct 12 '13 at 00:40
-
Of course not, that would be the world's biggest denial-of-service security hole in history. – Jim Garrison Oct 12 '13 at 00:41
1 Answers
1
No. You need root privileges to run shutdown/reboot.
However, you can exec a system command which has setuid root and runs shudown/reboot. Do you consider setuid/setgid equivalent to sudo for your question? Not recommended.
Here is how to run a system command, (How to execute system commands (linux/bsd) using Java).
Oh, and there is JNI (http://www2.sys-con.com/itsg/virtualcd/java/archives/0510/Silverman/index.html), again setuid.
Another way to shutdown the system would be to connect to a Tcpip controlled power switch. Then you could power off the system. Did you ensure security on your ehternet power switch? Powering the system back on is another challenge.

Community
- 1
- 1

ChuckCottrill
- 4,360
- 2
- 24
- 42