Cheers for the reply, I had feared as such! I didn't want to have to code two different apps (windows or linux), or at best have large block of code around a few cases base on the result of sys.platform.
The system is based on Windows at the moment, but I would of liked to have produced a version on Linux for evaluation purposes. Thanks again, I'll look up the SID and Token you mentioned. Wesley Brooks On 12/12/06, Tim Golden <[EMAIL PROTECTED]> wrote: > | I've had a quick scan around and can't find a way to identify the user > | who is logged in on the machine while a script is running? I've seen a > | few mentions of it being possible using bits of the win32 library but > | I would have liked my software to be portable with no adjustments. > | > | How can I run a script in the background? I will be writing a > | (prototype) machine control interface and would like the users to be > | able to log out, but leave the script running. When the next user logs > | in they can open up a portal (preferably in the system tray) to give > | them control of the system again. When I link this to the user > | identification I would be able to vary the access to the machine > | depending on the access rights of the user. > > I very much doubt if even the rest of what you're > doing is going to be particularly portable, so I > wouldn't worry too much if the logged-on user bit > isn't either. It looks to me as though you're > working at O/S-specific level. Python doesn't > offer any particular abstraction over detached > processes etc. In Windows you'd have to use a Service, > in *nix a daemon (I think). > > To talk about possibilities on Windows which I know > better, it should be possible to have a service > running which can be messaged to by a desktop app > run from the system tray or elsewhere. When the > desktop app sends its signal to the service it could > send through the SID or Token of the logged on user > which the service could then use to authorise or > not. > > But this is all quite Win32-specific (as well as > being hand-wavingly unspecific). I don't know > how you'd go about it on *nix but I bet it's nothing > like the same. > > TJG > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor