su then open program in X fails
I used to be able to do this no prob... now I can't and I have no idea what changed. I'm on a fresh 10.2 install. What I would like to be able to do is su to another user and then open a program as that user. For instance firefox. However when I do this I get.
Xlib: connection to ":0.0" refused by server Xlib: No protocol specified (firefox-bin:5392): Gtk-WARNING **: cannot open display: any suggestions? |
Try
Code:
sux - user_name |
I don't seem to have sux. I tried xhost +localhost which I saw was supposed to let me open things as another user and that didn't work either.
|
Try sudo instead of su.
|
Code:
sudo -u user firefox |
It should work this way, first in the terminal write
Code:
xhost +localhost Code:
su - user Code:
xcalc |
Code:
xhost +localhost Code:
su - user Code:
xcalc |
Ok so I did
Code:
xhost + Code:
nmap localhost |
xhost + will allow anyone to connect to your x server.
it's a securety risc. <there was some nonsense here before editing...> if i use " su " --->gui programs work ok without doing any settings. if i use " su - " --->things don't work ( which is logic ) egag |
Re: su then open program in X fails
Quote:
You can use "xhost" but it is insecure. The proper way is to use xauth authentication. you run "xauth list" as the user that is running the xserver (the first user) you will get some authentication keys copy the one that is starting as "hostname/unix:0" then su to the user you want to start the program as (the second user) (dont run "su -" just plain "su") then run "xauth add KEY_LINE" where KEY_LINE is the key you copied from the other user. KEY_LINE is the whole line (it is something like this "hostname/unix:0 MIT-MAGIC-COOKIE-1 big_key") you copy all this thing. then every X application should work for the other user. if you run "su -" then you get a login shell and it has the enviroment the user would have if he logged in. then all the procedure is the same except for an addition. you should set the DISPLAY enviroment variable (for example in a bash shell "export DISPLAY=":.0" ) |
Ok... so that allows me to open things, but it does not open them as the sued to user. It opens them as the original user.
|
I am having the same problem with using su to run a program from the command line for another user. The su command was working eariler on when I was configuring my system after installing Slackware 10.2. I noticed recently that it was not working anymore. I think it might be caused by the [slackware-security] X.Org pixmap overflow (SSA:2005-269-02) patch that was released by Pat. I haven't been able to test my theory yet, but will later today hopefully, if I have time, and I will post the results.
|
kde has a solution to this. If you use kde go to the "run command" option in the start (k) menu and enter
Code:
kdesu firefox |
For me and probably others, not everyone uses KDE. I personally use Window Maker on my Slack Box. So a real solution to the problem should be found rather than putting a band aide on it.
|
Quote:
i use slackware-current, so i have the updated X packages and i also use Windowmaker but it works ok for me. Also, kdesu works in windowmaker too as every other KDE program. you don't have to use kde to use Kwrite for instance. And if you don't like it there are many other "graphical su" programs |
All times are GMT -5. The time now is 02:53 AM. |