There are a few ways to output the user ID (UID) with
ps; a simple one is with
ps -fC X
Will give you information for all the X servers that are running (there can be more than one).
This presumes that the executable is called
X -- if there's no such process, you will have to target something else. Since it almost certainly at least has capital X in it (e.g.,
X11), an alternative is to filter through grep:
ps -o uid,comm -A | grep X
This removes the column headers, but the UID is the numerical one on the left. If this is
0, then the process is running root. If nothing turns up, try
ps -fA | grep X; this one involves more clutter.
Finally, if there is no process with capital
X in its name, try
x; you may at least find commands used to control it, such as
xinit. You could also try
dm, since display managers usually have this in their name (
gdm, etc). However, none of these is actually the X server, and although
xinit starts the server, the server executable often has the setuid bit set, meaning even though
xinit has a non-privileged UID, X will still run as root.