-   Slackware (
-   -   xterm error display not set (

fordwrench 09-08-2007 09:53 PM

xterm error display not set
I am running slackware 12.0 and when I run some scripts I get the following error:

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
xterm: DISPLAY is not set

How can I fix this?


owenjh 09-08-2007 10:11 PM

What program is it that you are trying to run?

Try changing to a non root user and see if the error message comes up (Either by exit, or su)

Normally this happens to me when I have an xterm open and I forget to logout of root.

you can also try to set DISPLAY by doing:

Hope this helps,

- Owen.

owenjh 09-09-2007 12:47 PM

Did it help?

fordwrench 09-09-2007 04:20 PM

Xterm will open when i run it as a non root user.
And the display command did nothing.
I need to get it to run as root.


acummings 09-10-2007 01:34 AM


You have to logon as root then startx as root in order to use x as root. (not normally a recommended procedure).

What you experience is normal. It is due to a default (out of the box) security measure.

This has been gone over before in this forum and solutions provided (including the needed mod if you want to go around the mentioned security measure).

I don't remember the mod. I searched, trying to find the thread (didn't find it).

I think it was within the last 7 to 9 months or less

Ok, I found it! It's post # 13 at next:


2) The reason you cannot connect to X server as root is that no user can use another users X server, not even root, without giving them permission.
To do that you need run 'xhost +local:' as the user whos X server it is, then set the DISPLAY variable for the user who wants to use X (in this case root).
Easiest way to do this is put the xhost comand in a startup file. For kde put it in ~/.kde/Autostart/startup. Then set the DISPLAY variable in roots ~/.bashrc or similar: 'export DISPLAY=:0.0'

fordwrench 09-10-2007 03:16 AM

Ok I tried to set the xhost in a file called "startup" and "startup."
neither of which worked.

and also created a file called .bashrc and set the display in it also.

didnt work.

Still trying to resolve this.


Btw I am logging in as root and starting X as root...

fordwrench 09-10-2007 01:38 PM

when I run xhost +local: I get :

xhost: unable to open display ""

acummings 09-10-2007 02:44 PM


Btw I am logging in as root and starting X as root...
Well then, that voids (xhost and DISPLAY that I had posted) since I'd assumed you were a user who su to root and then as root was trying to use x server but that the only x server running would be the user's x server -- IOW a case of root trying to use the user's (not root's) x server.

You'll likely need to provide more detail in order to get help. ie, what program, is it supposed to be suid or did it somehow get modified into suid. Specific steps of what you're doing (including how you logon as who and who's x server is running, leading up to and including the error.

How about your x configuration is anything been configured to non-standard here?


fordwrench 09-10-2007 04:02 PM

I am running "" a script for running the aircrack suite.
I have a basic Slackware 12.0 install with kde as the desktop.


is it supposed to be suid or did it somehow get modified into suid
I dont really know what it really means for a program to be suid.

I boot the computer, logon as root, startx, open a terminal window and run the script "./"

i run
the scan option and when it gets to the point that it is to open an xterm window and run the airodump-ng program. It does not run the airodump-ng and gives the error and returns to beginning of the script menu.


I dont know if it supposed to be run suid but it does run on the many different live pentest security cds. Ie backtrack,whoppix, whax and auditor

evilDagmar 09-11-2007 05:34 AM

If you want to preserve the things in the environment that let you spawn apps to the X display as root, you need to change to root using `su` and not `su -`. The dash basically makes it flush the things you need from the environment.

acummings 09-12-2007 01:32 AM

which airodump-ng

then run ls -la on airodump-ng

(so as to find out who owns the suid file)

Since at least one of your that you mentioned apps/script has the s bit set on it (suid) then perhaps what you need to do is to find out who the owner of the suid script/app is.

My guess that what I just said is so is because url above tells me that an suid "runs as the owner of this suid, **NOT** as who executed this suid (unless these two [owner/executor] accidentally happen to match)"

**All** of the above leaves it open to "as the root user, you are trying to use a user's (not root's) X server (if perchance the suid bit file/app/script **is OWNED by a user**

All of which -- ie it's root that's trying to use a user's x server. but nonetheless it is the same issue that I shared earlier which is that the use of X is dis allowed except for the user that started x

Why must you run it as root?

Probably you need to run it as a user. If (heaven forbid) you must run it as root then you may need to either remove the s (suid) bit or do as per my former (but in reverse) and once you find **who owns the suid file** given if it is a user

And if you must run it as root then you'll need to get it so that root can use a user's x server (but instead, I'd just remove the suid or s bit).

Are we getting any warmer?


trevor.screws 07-26-2012 09:24 PM

Check the X11 X Display Location
I got the same error as one of the first posts. I read a tutorial on how to set it up. It said to set the X Display Location = :0.0 - I thought it meant just '0.0'; however, that is incorrect. You should actually put ':0.0' [i.e. include the colon]

tonj 09-21-2012 02:30 PM

to the OP:
did you ever resolve this? I'm using backtrack5 and trying to run airoscript-ng and I'm also getting:
Warning: This program is an suid-root program or is being run by the root user etc etc. I can't find a solution to this anywhere. There's no help on this at the backtrack forum or the ubuntu forum. If you resolved it could you share the solution?

Varadarajan 12-04-2012 08:28 AM

In your .profile file located in your home directory, please add "xhost +local:". This will give local users access to X Windows. This is not enough to start gui programs from cron or as background processes without a shell. If you are able to launch your program from a shell as a background process and does not work as cron, then make sure that you have a small program to launch your program via system/shell command. This program can then be configured in cron or other background processes that dont use shell.

All times are GMT -5. The time now is 03:06 AM.