[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: which display is active and which user is logged in? (kdm?)



On Thu, Apr 03, 2003 at 02:35:48AM +0200, Achim Bohnet wrote:
> Great one peace more of the puzzle.  Here fgconsole works also for normal user:
> [...] 
> It this a (security) bug?
>
no, that's a bit permission magic done by PAM and/or the Xstartup
script. every system does something different here ...

> I've tried
> 	echo some garbage > /dev/tty8
> but :1 (on vt8) is still working.
>
the x-server does not use the tty, it uses the vc. when the server is
gone you can switch to the vt and see the garbage you put there.

> Back on topic ;)  Missing is now  vt# -> display#.  I hacked this little
> script.
>
this is the only way to get this information. :-(

> (Better methods that work with {k,g,w,x}dm etc welcome.)
> 
i'll build this into kdm's query interface, but behind the scenes kdm
has no other choice than to a) do the same or b) enforce a vc with vtX
on the server command line.

> #!/bin/bash
> vtnum=`fgconsole`
> match=`grep -l " using VT number $vtnum$" /var/log/XFree86.*.log`
> if [ "$match" ]; then
>         display="${match#/var/log/XFree86.}"
>         display="${display%.log}"
>         user="`who | grep " :$display " | awk '{print $1}'`"
>         echo display=:$display
>         echo user=$user
> 	# groups $user | grep -q camera && exec su - $user  "DISPLAY="$display" exec digikam 
> 	exit 0
> else
> 	exit 1
> fi
>
this scipt will fail if an already terminated server used the same
display as another currently running one. you should only check the logs
of currently running displays, i.e., loop on the display entries from
`who`.

greetings

>   To me vi is Anti-Virus software:  Signature not copied ;)
> 
grinch! ;)

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.



Reply to: