running X-11 programs as root

Hello,

I would like to run gedit as root while logged into my regular user account. When I try to launch gedit from the command line as super user, I get this message:

Gtk-WARNING **: cannot open display:

Any suggestions or word arounds? It would make my life a lot simpler to edit files from gedit that only have root write permissions

Thanks,

Allasso

as your normal user

xhost +`hostname`
echo $DISPLAY

switch to root

DISPLAY=whateverwasprintedbefore
export DISPLAY

however, becoming familiar with a common command line editor is a very useful skill.

Please ignore - (dummy post so I could subscribe to email notification)

Thank you, Porter, that did it. (though I hardly understand what I was doing there, just followed the recipe :slight_smile:

useful at times, yes, but sometimes quite tedious.

Thanks again,

Allasso

Please don't do what was advised if you have security in mind. Use ssh tunneling + keys and the ssh-agent to allow root access to X based services.

fortunately security is not really an issue in my situation, but I do appreciate the advice.

Thank you.

Allasso

I heard this suggestion:

"To get around this and other idiotic privilege problems created by using sudo, I just open a gnome-terminal window and run "sudo bash". That will give you root privileges with the proper environment setup for starting GUI apps as root. It also allows you to continue running the rest of your GUI applications as a less privileged user."

What do you think?

Since Porter's suggestion works, I don't want to break it to try this out. In the past I have tried simply running " sudo GUIapplication " but I have found this not to be a good idea.

Any Link for SSH Based X Server access ?

The xauth issue is still going to be a problem afaik. I've always found that the simplest and most scalable way to deal with the 'need access as user 'n' for remote X applications' is to have the user create a ssh key, password protect it, familiarize themselves with ssh-agent for password-less access and use some sort of management solution for the user keys thus distributed. YMMV.