[Tutor] Complete Shutdown
Steven D'Aprano
steve at pearwood.info
Tue Nov 2 00:01:37 CET 2010
Alan Gauld wrote:
>
> "Chris King" <g.nius.ck at gmail.com> wrote
>
>> How do I completely shutdown a computer without administrative
>> rights using a simple python script.
>
> If you have such a computer get rid of it, it fails the most basic test
> of a secure operating system. No program that runs upon it could
> ever be relied upon!
I'm not so sure about that... I think a personal computer which didn't
allow ordinary, unprivileged users to safely shut it down would be
worse. One shouldn't need to be root (or Administrator) to turn your own
laptop or desktop off! Do we really want Aunt Tilly just flicking the
power switch when she wants to turn her computer off?
Of course in a multi-user system, things are more complicated, and nor
do you want arbitrary programs to be able to shut down your computer.
Imagine if your browser could turn your computer off. Imagine if
arbitrary websites could turn your computer off. Chaos and pain everywhere!
A bit like running IE 6 really :)
An interesting question would be, given that you do have administrator
rights to log out/reboot/shut down, how would you do so from Python? The
solution will depend on the OS and possibly the window manager, but
other than that, I'm completely out of ideas.
--
Steven
More information about the Tutor
mailing list