LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   cannot start programs as another user (https://www.linuxquestions.org/questions/slackware-14/cannot-start-programs-as-another-user-35293/)

lusko 11-12-2002 03:25 PM

cannot start programs as another user
 
Hi all,

When i'm logged as normal user and su to root, cannot start other programs as root from shell. Same with other users. For example typing $ konqueror& I get
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

konqueror: cannot connect to X server :0.0

or
typing $ xmms&

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified


** CRITICAL **: Unable to open display

any hints?
thanks,
Lusko

DavidPhillips 11-12-2002 04:18 PM

try this to allow access by user to X server

xhost + username

lusko 11-13-2002 09:38 AM

it's not working..

the user i'm trying to give access to X is "testing" when i'm logged as lusko. this is what i did

root@darkstar:~# xhost +testing
xhost: unable to open display ""
root@darkstar:~# exit
logout
lusko@darkstar:~$ xhost +testing
xhost: bad hostname "testing"
lusko@darkstar:~$

thanks,
lusko

NSKL 11-13-2002 09:57 AM

just do
xhost +
as testing
then su to root and try to run a program.
Also man xhost is helpful. :D
-NSKL

lusko 11-13-2002 11:16 AM

k, i did..

testing@darkstar:~# xhost +
xhost: unable to open display ""

then i root
root@darkstar:~# emacs&
[1] 787
root@darkstar:~# vim&
[2] 788

[1]+ Stopped emacs
root@darkstar:~#

[2]+ Stopped vim
root@darkstar:~# konqueror&
[3] 789
root@darkstar:~# konqueror: cannot connect to X server

[3] Exit 1 konqueror

cannot open anything..


help appreciated.. thanks

LNXman 11-13-2002 11:57 AM

Quote:

Originally posted by lusko
it's not working..

the user i'm trying to give access to X is "testing" when i'm logged as lusko. this is what i did

root@darkstar:~# xhost +testing
xhost: unable to open display ""
root@darkstar:~# exit
logout
lusko@darkstar:~$ xhost +testing
xhost: bad hostname "testing"
lusko@darkstar:~$

thanks,
lusko

When you are logged in as lusko, type xhost +<your_host_name || user_name>, or xhost + (man xhost for more info). Then, log in as testing. At this point, testing should be able to open the XFree86 display through lusko since lusko allows other connections through its current connection.

BTW, when you see something like unable to open display "", it means that the evironment variable DISPLAY is not defined for the current user that is trying to open an XFree86 connection. Therefore, you would have to create it like the following:
(assuming you are using an sh derivative)
export DISPLAY=:0 <- as long as it is your localhost, otherwise you would type the following export DISPLAY=<hostname>:0.

GL

P.S. You have to be logged in straight into lusko, otherwise if you log in as,. . . hmmmmm. . . let's see. . . ROOT! (hope this is not a habit), then you have to make the same calls for root, before making them to lusko. . .

/edit: added P.S.

lusko 11-13-2002 01:23 PM

it works!
 
K it works, thanks a lot LNXMan :)

i was able to launch konqueror through lusko logged in as testing, however got a bunch of errors..

lusko@darkstar:~$ su testing
Password:

I once witnessed a long-winded, month-long flamewar over the use of
mice vs. trackballs... It was very silly.
-- Matt Welsh


testing@darkstar:/home/lusko$ konqueror&
[1] 1711
testing@darkstar:/home/lusko$ sh: iceauth: command not found
ICE Connection rejected!

DCOPClient::attachInternal. Attach failed Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed
ICE Connection rejected!

DCOPClient::attachInternal. Attach failed Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed
DCOPServer self-test failed.
sh: iceauth: command not found
kdeinit: DCOPServer could not be started, aborting..

lusko 11-13-2002 04:02 PM

k, i'm getting closer. After extensively searching the net for answers i found out that the problem has to do with DCOPserver, KDE's Desktop Communications Protocol, and a PATH problem to iceauth. i tried to start it typing $ dcopserver and got the exactly same error. What i find really weird is that even when getting those errors the application launches. Is it maybe just a simple PATH problem dealing with iceauth?? i see iceauth when su - only and not when i su (without -)?? same for normal users. where should i look at now? what's the best way to fix this??
thanks in advance for all ur help!

LNXman 11-13-2002 10:01 PM

You are right when you say there may be a path problem. What you should do is su - <user_name>. Once you are <user_name> then you have to create the DISPLAY environment variable as I mentioned in my previous post
. . . export DISPLAY=:0 . . . blah, blah

Give that a shot.

GL

lusko 11-14-2002 01:23 AM

works perfectly! thanks!!! :)

LNXman 11-14-2002 01:38 AM

Quote:

Originally posted by lusko
works perfectly! thanks!!! :)
De rien

Cyclops 11-30-2002 04:43 PM

More info needed regarding this...
 
Hello LNXman, or anyone else that can help. I frequently run into this problem in Slackware, too, but never in when in Redhat and/or Mandrake.

Is there some place that these commands can be inserted to make them permanent? TIA... :)

LNXman 11-30-2002 05:24 PM

There are a couple things you can do:

You can add as small hack to set the DISPLAY variable whenever you use: su - to the global profiles under /etc, or to the local user's shell profile you use under ~/.<shell_profile_file>

Consequently, you can alias su under the profile you decide to use like this: alias su='/bin/su -'. Such that you don't forget to load profiles when su-ing.

(Assuming you are playing with a server)
Just take into consideration WHO you are giving these settings to. Do you want to make them global for everyone (just to be nice), or specific user's or group's. What about root? Or you just don't care. . . ;) Just a few questions for you to consider when hacking away. . . Have fun.

GL


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