xterm is throwing below error on RHEL 7.2:

$ xterm &

[1] 21638
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s
[1]+  Exit 1                  xterm

$ rpm -qa | grep -i xterm

what I am missing here?

  • rpm -V xterm says? Nov 6, 2017 at 13:51
  • @Ignacio: nothing
    – dcds
    Nov 6, 2017 at 14:57
  • try to remove it and install it again Nov 6, 2017 at 15:11
  • try to remove it and install it again Nov 6, 2017 at 15:11

1 Answer 1


short: don't run the application as root


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.

  • The $ indicates that it's being run as a normal user, versus # for root. Nov 6, 2017 at 23:14
  • He could have chmod'd the program. Just as likely, running with a prompt set to '$'. Take your pick. Nov 6, 2017 at 23:15
  • 1
    Right, but rpm -V xterm returned nothing, which means that they haven't been tampered with. Nov 6, 2017 at 23:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .