short: don't run the application as root
long:
The message tells you what's wrong. The usual way to get this message is by logging in (as your normal, non-privileged user) and using su
or sudo
to switch to the root
user.
The message (and check) was added in 1997 (it appeared first as a patch to XFree86 at the end of June as a followup to discussion in May, and two weeks later in X11R6.3).
Before then, root
could connect to your X session and run any program that you (as root
) chose. Unfortunately, many of the programs that were likely to be used weren't secure. (This is still the state for almost all of the desktop applications).
The X library making the check does this after seeing that it's the root
user and then removing environment variables (such as DISPLAY
) which might tempt you into falling into that morass of unsecured applications.
Some systems allow the root
user to log into a desktop session; for those most immediately-accessible applications have been selected to keep things relatively safe. Some don't do that.
Now... in Red Hat 7, xterm
is not installed set-uid or set-gid. set-uid to root was used 20 years ago to open the BSD-style pseudo-terminals, and set-gid was used to update utmp. Both of those went away quite a while ago. You can see that by doing
ls -l /usr/bin/xterm
If there's a set-uid or root user permission to be found, the place to start looking is at the shell from which you're running xterm.
rpm -V xterm
says?