LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   set "xhost local:" perpetually (https://www.linuxquestions.org/questions/slackware-14/set-xhost-local-perpetually-442859/)

pbhj 05-08-2006 02:22 PM

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

dive 05-08-2006 05:26 PM

Try putting the command in .bash_profile or .bashrc

jong357 05-09-2006 08:41 AM

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....

tobyl 05-09-2006 01:21 PM

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

pbhj 05-09-2006 04:08 PM

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

tobyl 05-09-2006 04:45 PM

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

pbhj 05-09-2006 05:41 PM

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!!


All times are GMT -5. The time now is 05:18 AM.