D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] SOLVED: Identifying active user (was: Re: Parsing INI files)

 

On 1 Oct, 2012, at 1:32 am, Philip Hudson wrote:

BTW, what I'm trying to do is detect who (if anyone) is the active user, defined as not just logged in but "owning" the display and keyboard for the time being, so if you've got a smarter way of doing this, please tell me. (Obviously, this is a multi-user system we're talking about). This information is definitely accessible in the file mentioned above, but if there's a better way of getting it, I'm all ears.

Solution found, for those who are interested:

If your system uses ConsoleKit, which all three debian-derived systems I use do, then you have the 'ck-list-sessions' command, which outputs one or more twelve-line user session descriptions (13-line if you include the delimiting 'SessionNNN' line), line 5 (6) of which is the boolean property 'active', and line 1 (2) is the property 'unix- user' (the UID).

--
Phil Hudson                  http://hudson-it.no-ip.biz
@UWascalWabbit                 PGP/GnuPG ID: 0x887DCA63


--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq