Centos – Understanding “vncserver -list” with respect to Xvnc processes

centospsvnc

I have a pretty standard setup on a Centos 6.5 VM. I've configured VNC sessions to start at boot per CentOS's wiki

VNCSERVERS="1:root 2:moe 3:curly"
VNCSERVERARGS[1]="-geometry 640x480"
VNCSERVERARGS[2]="-geometry 640x480"
VNCSERVERARGS[3]="-geometry 800x600"

In my case, I have sessions 1 through 12 configured, with 2 through 12 being local users, and session 1 belonging to root.

All of my sessions get created on boot, as expected, which I can verify if I run "ps -ef | grep Xvnc"

[moe@stooges ~]$ ps -ef|grep Xvnc
root     26037     1  0 Aug19 ?        00:00:14 /usr/bin/Xvnc :1 -desktop stooges.domain.com:1 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn
moe 26126     1  0 Aug19 ?        00:00:00 /usr/bin/Xvnc :2 -desktop stooges.domain.com:2 (moe) -auth /export/home/moe/.Xauthority -geometry 1680x1050 -rfbwait 30000 -rfbauth /export/home/moe/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn
(... and so on for all 12 sessions...)

I'm able to connect to all these, as well as kill them as root using "vncserver -kill :PORT#

Where I get confused is when I compare this result with the output of "vncserver -list"

[moe@stooges ~]$ vncserver -list

TigerVNC server sessions:

X DISPLAY # PROCESS ID
:1      22091
:2      1929
:12     30719

If I run "vncserver" as root or any other user, that new session ends up getting represented in the results of both "ps -ef|grep Xvnc" and "vncserver -list"

What is the relationship/behavior I'm missing of the vncserver service, Xvnc processes created at boot, Xvnc sessions created via user execution of "vncserver"?

Best Answer

It's really no big mystery, vncserver -list lists sessions for your user.

The way to enumerate sessions for all users is in fact to do what you are doing: ps -ef | grep vnc

Related Question