X programs from terminal

Discuss Applications
Post Reply
Master of Reality
guru
guru
Posts: 562
Joined: Thu Jan 09, 2003 8:25 pm

X programs from terminal

Post by Master of Reality »

whenever i try to run an X program from terminal (openoffice installer to be exact) it says it cant connect to Xserver. I did "xhost +" to take off access restrictions completely, but it still doenst work. I am using Slackware, on konsole and "su -"'d as root.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

What is your DISPLAY variable set to?

$ echo $DISPLAY

Master of Reality
guru
guru
Posts: 562
Joined: Thu Jan 09, 2003 8:25 pm

Post by Master of Reality »

:0.0

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

I actually meant, what is the DISPLAY variable set to after you "su -":

# echo $DISPLAY

but after doing a quick search it appears to be slightly more complicated in Slackware:

http://free.house.cx/~eil/slackwarenotes.html
Running X apps as root on a user's display
By default, root does not have the authority to start a client on someone else's X session. If such capability is needed, the following simple instructions will allow it. This method depends on there being only one regular user of the system (the one running the X session).

As root, cd to ~ and do:

rm ~/.Xauthority
ln -s ~user/.Xauthority

where user is the name of the user with the X session. Next, determine what display the session is using. To find out, enter:

echo $DISPLAY

as the user. Usually this will be :0.0. Put the environment variable and its value into root's .bash_profile and you're all set.

Master of Reality
guru
guru
Posts: 562
Joined: Thu Jan 09, 2003 8:25 pm

Post by Master of Reality »

erm... i cant edit the .bash_profile to "Put the environment variable and its value into root's .bash_profile" because i dont have a .bash_profile
...what should i do?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Create one. Or add it to root's .bashrc.

Master of Reality
guru
guru
Posts: 562
Joined: Thu Jan 09, 2003 8:25 pm

Post by Master of Reality »

dont have a .bashrc

what should be in these files?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Create one, "man bash".

Master of Reality
guru
guru
Posts: 562
Joined: Thu Jan 09, 2003 8:25 pm

Post by Master of Reality »

i got the bashrc and bash_profile (copied from redhat... doesnt seem to have any special settings in it so it should be okay)... but what does it mean "Put the environment variable and its value into root's .bash_profile and you're all set"?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

It basically means put this in:

export DISPLAY=:0.0

Post Reply