display issue in slack

Place to discuss Slackware
Post Reply
User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

display issue in slack

Post by Calum » Sun Jan 07, 2007 5:57 am

i know we've had this before but i can't find it:

Code: Select all

root@harvey:/home/calum/pkgs# slapt-gui 

Gtk-WARNING **: cannot open display: 
root@harvey:~# export DISPLAY=LOCALHOST:0.0
root@harvey:~# slapt-gui 
Xlib: connection to "LOCALHOST:0.0" refused by server
Xlib: No protocol specified


Gtk-WARNING **: cannot open display: LOCALHOST:0.0
this is when i su - to root as a normal user.
how is this sorted out again?

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 » Sun Jan 07, 2007 8:55 am

Before you switch user do an "xhost + localhost". You should also be able to use xauth to do it after you switch user like this:

xauth merge ~username/.Xauthority

You can also use the "pam_xauth.so" module in your pam configuration for "su" (/etc/pam.d/su) which is how Fedora and other distros do it that take care of this automatically.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Sun Jan 07, 2007 1:58 pm

thanks for the quick reply, however:

Code: Select all

bash-3.1$ xhost + localhost
localhost being added to access control list
bash-3.1$ su -
Password: 
root@harvey:~# slapt-gui

Gtk-WARNING **: cannot open display: 
bash-3.1$ xhost + harvey   
harvey being added to access control list
bash-3.1$ su -
Password: 
root@harvey:~# slapt-gui

Gtk-WARNING **: cannot open display: 
also, i noticed that there wasn't an /etc/pam.d directory, so i have made one, and have now put this in /etc/pam.d/su as per http://ldots.org/ldap/

Code: Select all

auth       sufficient pam_ldap.so
auth       required   pam_unix.so  try_first_pass

account    sufficient pam_ldap.so
account    required   pam_unix.so

session    sufficient pam_ldap.so
session    required   pam_unix.so
even though i don't actually understand it.

any further ideas?

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 » Sun Jan 07, 2007 2:54 pm

In the first example you need to set your DISPLAY variable after switching to root (export DISPLAY=:0.0). Regarding pam, you must not have pam installed if you don't have a pam.d directory. Creating an /etc/pam.d/su is going to do nothing if you don't have pam installed and configured and have the pam_xauth.so module installed. I don't know what the best Slackware way would be to install pam, this is done by default on most other distros. Maybe you just have to install the package. It's also possible that slackware puts the configuration files in a location other than /etc/pam.d.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Sun Jan 07, 2007 5:19 pm

thanks void! xhost + localhost before switching user and export DISPLAY=:0.0 after switching, works perfectly well. This will probably do me since i will only need this occasionally for slapt-gui (and even then i will use slapt-get for preference most of the time. what a daftie i am not noticing i don't have pam installed, i assumed it'd be installed by default, but i did an interactive menu install and i was quite ruthless about things i didn't want.

slack has a whole heap of things i had forgotten you have to do to make it liveable in! still, it's all coming back slowly but surely. i can't believe they still include . in the PATH for normal users in /etc/profile though, and i can't figure out how to unmute the sound yet but i'll get there.

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 » Sun Jan 07, 2007 5:33 pm

Calum wrote:i can't believe they still include . in the PATH for normal users in /etc/profile though
Please tell me you're kidding.

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

Post by Master of Reality » Mon Jan 08, 2007 10:25 am

Last time i used slackware, the current directory wasn't in the path.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Tue Jan 09, 2007 5:39 am

rubbish.

have you modified /etc/profile since you installed slack? if not, go and have a look. there's config stuff there which is not commented out (which it should be in my opinion) that adds the current directory to normal users' PATH variable. This was there when i started using slack with 8.0 and it's still there in 11.0. It's something i always fix (if that's the right word) after installation. I did decide though, this time, that i would use debian instead of slack for a while. i got the debian CD at the same time as slack and have never tried debian properly, while i have used slack before for some time, so fair's fair, i have installed debian instead. i am sure the learning curve will prove as stimulating as slackware did.

EDIT: actually do your local (ie: in your home dir) config files override /etc/profile? if so then possibly this is why most (all?) normal users would not get this added to their PATH, because their config would never get as far as running /etc/profile

i still think it's dumb to leave it in there though.

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 » Tue Jan 09, 2007 9:10 am

Just do an "echo $PATH" and see what is in the variable after logging in.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Tue Jan 09, 2007 10:13 am

well, i can't test that myself since i wiped the partition and stuck debian on there by now. still, i'd be interested in what the slackers here say about this, after having a quick shufti in their /etc/profile as well that is!

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Tue Jan 09, 2007 4:17 pm

actually i got really pissed off with debian so now am back to slack.

so, the current directory is not in the default PATH by the way, i just checked, but it definitely is in /etc/profile as follows:
# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi

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 » Tue Jan 09, 2007 4:25 pm

I have NO idea why that would be in there.

Post Reply