简体   繁体   English

使用不带sudo权限的java重新启动运行ubuntu的计算机?

[英]Restart a computer running ubuntu using java without sudo rights?

有什么方法可以使用Java应用程序重新启动运行Ubuntu 13.04的计算机,而无需任何sudo权限?

No. You need root privileges to run shutdown/reboot. 否。您需要root特权才能运行shutdown / reboot。

However, you can exec a system command which has setuid root and runs shudown/reboot. 但是,您可以执行具有setuid根目录并运行shudown / reboot的系统命令。 Do you consider setuid/setgid equivalent to sudo for your question? 您是否认为setuid / setgid与sudo等效? Not recommended. 不建议。

Here is how to run a system command, ( How to execute system commands (linux/bsd) using Java ). 这是如何运行系统命令,( 如何使用Java执行系统命令(linux / bsd) )。

Oh, and there is JNI ( http://www2.sys-con.com/itsg/virtualcd/java/archives/0510/Silverman/index.html ), again setuid. 哦,还有JNI( http://www2.sys-con.com/itsg/virtualcd/java/archives/0510/Silverman/index.html ),再次是setuid。

Another way to shutdown the system would be to connect to a Tcpip controlled power switch. 关闭系统的另一种方法是连接到Tcpip控制的电源开关。 Then you could power off the system. 然后,您可以关闭系统电源。 Did you ensure security on your ehternet power switch? 您是否确保ehternet电源开关的安全性? Powering the system back on is another challenge. 重新打开系统电源是另一个挑战。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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