How to determine, as root, which user owns X display :0? (on a Fedora 18 system with defaults)
ps -ef|grep X will give you the info.
For example, on my computer:
user001 2721 2705 0 02:35 tty1 00:00:00 xinit /home/user001/.xinitrc -- /etc/X11/xinit/xserverrc :0 -auth /home/user001/.serverauth.2705 root 2722 2721 13 02:35 tty7 00:10:10 /usr/bin/X -nolisten tcp :0 -auth /home/user001/.serverauth.2705 user001 3475 3462 0 03:51 pts/0 00:00:00 grep X
Here, we can see that
xinit and uses the display
root is the owner of the
On most installations, users don't use the
xinit command (or
startx which internally calls
xinit). The X server is launched by root during the bootup process. In that case, root is the "owner" of the display.
This is the exact command:
ps ho user $(pgrep X)