sudo firefox throws GDK Backend Error

I have been on it for the past couple of days and can’t get my head around it. http://forums.mozillazine.org/images/smilies/eusa_wall.gif
Why does OpenSuse throw error when firefox is tried to run with “sudo” privileges(just write “sudo firefox” in terminal). http://forums.mozillazine.org/images/smilies/icon_eek.gif
The error thrown is - “GDK- BACKEND ERROR. No displays found.”
I have changed the permission and checked the display drivers, gave root permission to user through “sudoers” file. http://forums.mozillazine.org/images/smilies/eusa_think.gif
Also checked the DISPLAY are same for “su” and user through “echo $DISPLAY” (both are 0)(Tried giving screen as well, DISPLAY = 0.0, still not working)
Even uninstalled and installed firefox again(used yum and yas).

Just to be sure, I have 2 different machines with opensuse and both give this error

Can anyone suggest any solution.
Thanks in advance

Because it just isn’t possible to run graphical applications with sudo’s default settings in openSUSE.
For security reasons it filters out most user’s environment variables e.g. the $DISPLAY.

You should not run Firefox as root anyway, and I cannot even think of a reason why you’d want to.

[QUOTE=harshal9;2812320]just write “sudo firefox” in terminal/QUOTE]
Apart from Wolfi323’s technical explanation and his warning, I want to stress that doing this counts amongst the more stupid actions one can do. And while you can of course do to your system what you want, you should not expect that any of the members here ever did likewise and thus can advise you on such an action.

Thank you.
Actually, the reason I have to open firefox with “sudo” is because it is triggered by a python program(this program needs to modify, create and delete some directories as well for which we need to give it “sudo” privileges )(this program runs on win and mac too so i cannot add sudo when modifying the file system).
It works fine on Ubuntu and Mint OS so I was hoping that opensuse will not throw any problem.
Is there any way to bypass the security measure and give $DISPLAY variable to sudo? That would help a lot.

Please let me know if you need any other detail.

Thankyou for your time.

if you really want to run firefox as root you need to do it with kdesu or gnomesu
there is a way to edit sudo’s configuration so you can run X applications with it but I’ve forgotten what it was it’s here in the forums you can search for it, but kdesu Firefox will work fine
just note that this will create files in /root/.firefox and that is not a good idea