Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 01-15-2005, 11:07 PM   #1
Registered: Dec 2003
Distribution: Slackware 9.1
Posts: 309

Rep: Reputation: 30
X display problems when running things from su

Its slightly minor, since I can bypass it with kdesu, but its so inconvenient at times, so finally I feel motivated to post it here.

I have Slackware 9.1, when say I am a normal user, need to su into root and run say, some admin tools that uses a GUI, I get errors complaining about not being able to connect to the server.

Furthermore, I am not sure if its related, how do I get X to accept all local connections across displays and tty's without having to run xhost with the local arguments and whatnot, and that itself is annoying because it can't be included in a startup script, because if I run it on the commandline, it complains, again.
Old 01-16-2005, 12:37 AM   #2
Registered: Apr 2004
Location: berkeley, ca
Distribution: slk10, winxp
Posts: 313

Rep: Reputation: 30
a possibly insecure solution is to run 'xhost +' as the user who is logged in. a better solution is to run the xauth command with the merge option. i ran into the second solution after googling a while ago, so i don't remember how to do it off the top of my head.

i was not able to find the exact page i found before, but i read the xauth man page, and this works for me:
root# xauth merge ~user/.Xauthority
this has effect until the user logs out or closes the x server.

Last edited by rgiggs; 01-16-2005 at 01:09 AM.
Old 01-16-2005, 06:25 PM   #3
Registered: Jul 2003
Location: Mississippi
Distribution: Slack9.1
Posts: 159

Rep: Reputation: 30
Run the applications from the command line. 'su -c "kwrite --options /file"
Old 01-20-2005, 04:49 PM   #4
Registered: Dec 2003
Distribution: Slackware 9.1
Posts: 309

Original Poster
Rep: Reputation: 30
this has effect until the user logs out or closes the x server.
Am I able to use this in an init script?
Old 01-20-2005, 08:08 PM   #5
Registered: Jan 2005
Location: Somerset, UK
Distribution: Slackware
Posts: 61

Rep: Reputation: 11
You need to create the file /etc/X0.hosts (thats a zero) it needs to be executable (thats 755) and it needs one line for every host that you would like given authority to draw windows on the display.


then when you su you need to use the export directive to set the DISPLAY and ensure that it becomes global, like # export DISPLAY=localhost:0.0 you could always consider setting that in the .profile for root

All these zero's represent the display number so if you are on display 100 you can set up a file called /etc/X100.hosts and use that the same way


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suse: confused on many things, why is installing things so hard? blackflare Linux - Newbie 11 10-16-2007 04:35 AM
Problems with Samba? Confused about a few things. Help!!!!! Pedal2Metal Linux - Newbie 10 10-25-2004 09:42 PM
System freezes - running out of things to test? ianv Linux - General 11 11-20-2003 02:37 PM
Problem with Liniux running things sulaiman_java Linux - General 5 04-06-2003 12:37 AM
freeing unneeded resources [things running in the backround] centr0 Linux - General 3 02-26-2003 01:09 PM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration