LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-08-2006, 03:22 PM   #1
pbhj
Member
 
Registered: Dec 2002
Location: UK
Distribution: Slackware 12; Ubuntu 7.10
Posts: 358

Rep: Reputation: 32
Question set "xhost local:" perpetually


I currently do "xhost local:" in a bash shell in my current KDE session to ensure that root apps can access my x session. Where and what should I set to make this a permanent change?

Cheers
 
Old 05-08-2006, 06:26 PM   #2
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Try putting the command in .bash_profile or .bashrc
 
Old 05-09-2006, 09:41 AM   #3
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
That's not too much better than what he's doing now. It would be better if you could put it in an .xsession or .xinitrc....
 
Old 05-09-2006, 02:21 PM   #4
tobyl
Member
 
Registered: Apr 2003
Location: uk
Distribution: slackware current
Posts: 769

Rep: Reputation: 66
dont know if it helps, but you might try this:

create a .profile in your home directory and add the following:

export XAUTHORITY=/home/$LOGNAME/.Xauthority
export DISPLAY=:0.0



or for all users, (except root!) maybe something like this in /etc/profile
if [ ! "`id -u`" = "0" ]; then
export XAUTHORITY=/home/$LOGNAME/.Xauthority
export DISPLAY=:0.0
fi

any help?
tobyl

edit: I guess this only works if there is only one x session running at any given time

Last edited by tobyl; 05-09-2006 at 02:27 PM.
 
Old 05-09-2006, 05:08 PM   #5
pbhj
Member
 
Registered: Dec 2002
Location: UK
Distribution: Slackware 12; Ubuntu 7.10
Posts: 358

Original Poster
Rep: Reputation: 32
Thumbs up profile.d

Tobyl,

I should have known that there wouldn't just be an answer but lots of options ... thanks for your suggestion, and thanks to the others too.

What I've done is to create a file (chmod'ed to a+x) in /etc/profile.d/ as /etc/profile executes all the scripts in this directory, the script has this in it :

#!/bin/bash
# Allow local users access to default display unless it's owned by root
if [ ! "`id -u`" = "0" ]; then
export XAUTHORITY=/home/$LOGNAME/.Xauthority
export DISPLAY=:0.0
fi


So far I've only spawned a new shell to see if the settings appear in the "export" list. They do and su'ing into root and running konqueror produces the desired result.

Thanks.

pbhj
 
Old 05-09-2006, 05:45 PM   #6
tobyl
Member
 
Registered: Apr 2003
Location: uk
Distribution: slackware current
Posts: 769

Rep: Reputation: 66
Great, I'm glad you had success.

One thing, though you probably realized anyway, is that many people su to root with 'su -'
but for that script to work you want to keep the users env, not inherit root's env, so you
are correct to use 'su'.
Store some notes somewhere of your modifications, in case one day you have to reinstall, as its a real pain when you can't remember all the little changes you made...

tobyl
 
Old 05-09-2006, 06:41 PM   #7
pbhj
Member
 
Registered: Dec 2002
Location: UK
Distribution: Slackware 12; Ubuntu 7.10
Posts: 358

Original Poster
Rep: Reputation: 32
Cool

Quote:
Originally Posted by tobyl
Store some notes somewhere of your modifications, in case one day you have to reinstall, as its a real pain when you can't remember all the little changes you made...
That's why I "su", I like to keep my env.

Also, that's why I chose not to edit profile directly and instead to add a script to profile.d/ easy for backup and upgrade management ... as for little notes, I expect I'll google it!!
 
  


Reply

Tags
console


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
Problem with "xhost +localhost" not staying set Nylex Linux - General 2 12-29-2005 10:55 AM
"xhost +localhost" a no go (Ubuntu, Debian) Malibyte Ubuntu 2 12-18-2005 01:04 PM
How to set the size of icons for "Starterbar" in "Gdekslets" Blue Jacket Linux - Software 4 11-23-2005 03:42 AM
"xhost +local:" in .xsession - a bad idea? umk Debian 5 06-14-2005 10:12 AM
difference between "Web server local URL" and "IPv4 address"? kpachopoulos Linux - General 2 09-17-2004 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

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