Demand, close Linux, UNIX requires root permissions, but root privileges cannot give others. What should I do if I need someone else? Write a program to listen to a port and accept user instructions. Then shut down. The server-side code is as follows: #! / Usr / bin / env pythonimport socketimport OS
Host = '' port = 9999 s = socket.socket (socket.af_inet, socket.sock_stream) s.Listen (1) while 1: conn, addr = s.accept () IF CMP ('192.168.1.111 ", addr [0]) == 0: Print' Shutdonw Now 'Os.system (' / sbin / shutdown -h now ') Breakconn.close () Of course this program is still not safe. So add a firewall to match, such as only a IP user is turned off. You can also read the allowed user list from the database, or file, and you can also add username password verification.