This forum has been archived. All content is frozen. Please use KDE Discuss instead.

starting applications as different user - dbus problem

Tags: None
(comma "," separated)
zsaja
Registered Member
Posts
66
Karma
0
hello there,

i could need some advice on the following problem: sometimes, i want to start some kde program as a different user than the one currently logged in. for example, my fried who also uses the same computer wants to quickly check mail in kontact etc. i'm not quite sure what the best way of doing this is. since just logging in via "su newuser" and then running the command fails, i usually do a "xhost +" before that. this way it is possible for the other user to launch gui programs, but there are dbus-problems. for example, "konqueror&" returns errors like

...
kdeinit4: preparing to launch /usr/bin/kded4
kdeinit4: Communication error with launcher. Exiting!
konqueror(8491): couldn't create slave: "Cannot talk to klauncher: Not connected to D-Bus server"
kded(8500): KUniqueApplication: Cannot find the D-Bus session server

kded(8499): KUniqueApplication: Pipe closed unexpectedly.
...

in the end, the program starts but is not working (for example konqueror cannot open any urls). i know i can get rid of this problem if i run

eval `dbus-launch` && konqueror &

instead of the plain konqueror&. this way it all works fine, but it is not a very convenient solution.

does anybody know how i could configure my system in such a way that the dbus-launch becomes unnecessary? or is there a completely different way of doing what i described?

best, zsaja

Last edited by zsaja on Wed Apr 08, 2009 7:07 am, edited 1 time in total.
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
You could try to modify your system setup such that login shells, e.g. new user sessions, always have their D-Bus session bus started automatically.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
zsaja
Registered Member
Posts
66
Karma
0
anda_skoa wrote:You could try to modify your system setup such that login shells, e.g. new user sessions, always have their D-Bus session bus started automatically.

Cheers,
_


sounds good - how would i do that? (kubuntu 8.10, if that matters)

zsaja
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
zsaja wrote:sounds good - how would i do that? (kubuntu 8.10, if that matters)


Sorry, no idea. Probably ask on the Ubuntu forum.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
User avatar
Ahmad Samir
Registered Member
Posts
127
Karma
0
OS
Try using:
su - newuser

Notice the extra - after su.
zsaja
Registered Member
Posts
66
Karma
0
medo3891 wrote:Try using:
su - newuser

Notice the extra - after su.


hm, when i tries this and run something like "konqueror &" afterwards, i get "konqueror: cannot connect to X server", although i issued an "xhost +" before.

zsaja
User avatar
Ahmad Samir
Registered Member
Posts
127
Karma
0
OS
Works here... no idea what's happening at your end, maybe try it without the xhost + ?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
This is because all variables referring to your users X session have been cleared by su.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
zsaja
Registered Member
Posts
66
Karma
0
bcooksley wrote:This is because all variables referring to your users X session have been cleared by su.


it behaves in a strange way here: when i run a "su - username" without the preceding "xhost+", i get for "dolphin&"

(6635)/: KUniqueApplication: Cannot find the D-Bus session server
(6634)/: KUniqueApplication: Pipe closed unexpectedly.

but for "konqueror&" i get "konqueror: cannot connect to X server". in both cases, the programs do not start. :'(

what is the extra dash in the su command supposed to do? maybe i have to add the respective users to certain groups?

zsaja

Last edited by zsaja on Thu Apr 09, 2009 6:34 am, edited 1 time in total.
User avatar
beermad
Registered Member
Posts
104
Karma
0
OS
zsaja wrote:
bcooksley wrote:This is because all variables referring to your users X session have been cleared by su.


it behaves in a strange way here: when i run a "su - username" without the preceding "xhost+", i get for "dolphin&"

(6635)/: KUniqueApplication: Cannot find the D-Bus session server
(6634)/: KUniqueApplication: Pipe closed unexpectedly.

but for "konqueror&" i get "konqueror: cannot connect to X server". in both cases, the programs do not start. :'(

what is the extra dash in the su command supposed to do? maybe i have to add the respective users to certain groups?

zsaja


The extra dash causes the shell to pick up the correct environment variables for the new userid, rather than inheriting those from the original one.

The reason it now can't connect to the X server is that it doesn't know its address. What you need to do after the "su" is
Code: Select all
export DISPLAY=:0.0
, replacing :0.0 with whatever you get in the original shell by executing
Code: Select all
echo $DISPLAY




Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]