Catching user switching and getting current active user from root on linux

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Dec 11 19:04:11 EST 2010


On Sat, 11 Dec 2010 11:43:13 -0800, mpnordland wrote:

> sorry, I've been busy, it's on linux, and current active user is the
> user currently using the computer. My program needs to switch log files
> when a different user starts using the computer.

I think you have missed what people are trying to tell you: if you're 
running Linux, you may have more than one human being logged into and 
using the computer AT THE SAME TIME. You can also have a single human 
being logged into the computer as more than one user, and one user being 
used by multiple human beings.

As we speak, I am logged into my Linux computer eight times, five times 
as myself (two GUI sessions, just to prove I can do it, plus three 
terminals), two times as root, and one time as another user; my wife's 
computer has two people logged in simultaneously (me and her); I'm also 
logged into a server at work, which currently lists eight people logged 
in twenty-one times between them.

Perhaps you should explain what problem you are trying to solve, rather 
than how you think you should solve it ("catch the user switching").



-- 
Steven



More information about the Python-list mailing list