[Tfug] How to detect graphical logins?

Brian Murphy murphy at coppershadow.com
Wed Jun 4 16:24:15 MST 2008


I don't think such a thing exists.  Standard tools that show who is 
logged in do it by reading utmp.  As you've discovered, this is advisory 
and thus not perfect.  You can add the -query localhost option to Xvnc 
(the vnc server) to force clients to login via xdm which in turn could 
be configured to use sessreg on startup and reset to register/remove the 
user in utmp.(this sessreg step might already be done by your 
distributor)  Make sure that xdm or the GNOME/KDE/CDE equivalent is 
listening for the XDMCP query.

As for how many users, I guess that depends on how you want to count me 
if I log in twice...just "me" or as 2 logins on the system.

The unix admin in me is more often concerned with what the users are 
doing, not so much who they are... because if they weren't supposed to 
be there, they shouldn't have an account.  If you have to do something 
like chargebacks for runtime, process accounting would be a far better 
avenue to explore than this.  /etc/security/limits.conf might also be of 
interest to you on linux for per-user limits.

Brian

Jeff Breadner wrote:
> Hi everyone
> 
>   Does anyone know of a program/script fragment that one can use to 
> detect how many users (and which users) are logged in to graphical 
> sessions on a Linux box (RHEL3 ideally)?  Tools like "who -a", "w" and 
> "users" all show console / shell sessions, for detecting VNC sessions 
> I've had to resort to "ps auxw | grep xconsole | grep -v grep | awk 
> '{print $1}'", which I'm not too happy with.
> 
>   I don't mind having to install a new utility if there's a good one out 
> there that will report what I'm after.  Does anyone know of such a 
> thing?  Bonus points if it also works with Solaris 7.
> 
> thanks
>   JB
> 
> _______________________________________________
> Tucson Free Unix Group - tfug at tfug.org
> Subscription Options:
> http://www.tfug.org/mailman/listinfo/tfug_tfug.org





More information about the tfug mailing list