Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Start daemon on X login [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Pilatus
n00b
n00b


Joined: 17 Oct 2011
Posts: 5

PostPosted: Wed Jan 18, 2017 10:06 pm    Post subject: Start daemon on X login [solved] Reply with quote

I'm having some inconveniences with my 3Dconnexion Spacenavigator 3D mouse. These things use spacenavd as their driver and the spacenavd daemon communicates through X Windows. Spacenavd runs as root.

I'm using slim as login manager and xfce as windows manager. X access control is enabled, and spacenavd needs an xauth token, which changes with every login. I can supply the right xauth token after login and then start the daemon, but how to automate the process, it's a little inconvenient?

How do I get slim/xfce to start the daemon with root privileges?


Last edited by Pilatus on Sun Jan 22, 2017 3:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14188

PostPosted: Thu Jan 19, 2017 2:48 am    Post subject: Reply with quote

In my opinion, you would be better served by not running the daemon as root. Run it as you, so that it has automatic access to your xauth token, and so that any bugs in it are limited to destroying your home directory instead of destroying your system.
Back to top
View user's profile Send private message
Pilatus
n00b
n00b


Joined: 17 Oct 2011
Posts: 5

PostPosted: Thu Jan 19, 2017 7:38 pm    Post subject: Reply with quote

Hu wrote:
In my opinion, you would be better served by not running the daemon as root.


I tried that, but that triggers a bug. That driver is sufficiently old not to shoot the file system, I think.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14188

PostPosted: Fri Jan 20, 2017 2:53 am    Post subject: Reply with quote

What bug does it trigger? There might be an easy fix for it.
Back to top
View user's profile Send private message
Pilatus
n00b
n00b


Joined: 17 Oct 2011
Posts: 5

PostPosted: Fri Jan 20, 2017 2:53 pm    Post subject: Reply with quote

If you start the daemon as user the process it uses 100 % of CPU time. The issue has been mentioned in this thread: https://sourceforge.net/p/spacenav/mailman/message/29629223/

It's not the repeat interval that's discussed here that's the problem, I tried that, it's a different kind of bug.
Back to top
View user's profile Send private message
Ji.M
n00b
n00b


Joined: 15 Jan 2017
Posts: 2

PostPosted: Fri Jan 20, 2017 9:58 pm    Post subject: Reply with quote

You could extract the auth-token and merge it into ~/root/.Xauthority:

Code:

# xauth -f <your home>/.Xauthority extract - :0 | xauth -f <root home>/.Xauthority merge -


before you start your mouse-ctrl.

or some workaround via sud

Ji.M-edit: sudoers-file:
Code:

## Groups of commands.  Often used to group related commands together.
Cmnd_Alias     MOUSED = /<your>/<mouse>/<daemon>

## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
Defaults env_keep += "HOME EDITOR PAGER LESS MORE"
##
## X11 resource path settings
Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
Defaults env_keep += "XDG_SESSION_COOKIE"

##
## User privilege specification
##
<your-uname> ALL=(ALL) NOPASSWD: MOUSED



... and start it via 'sudo <yourmoused>' from your HOME-startups
Of cause as always convenience comes for a price.

Greetings, Jirka
Back to top
View user's profile Send private message
Pilatus
n00b
n00b


Joined: 17 Oct 2011
Posts: 5

PostPosted: Sun Jan 22, 2017 3:55 pm    Post subject: Reply with quote

Ji.M wrote:
You could extract the auth-token ... and
start it via 'sudo <yourmoused>' from your HOME-startups
Of cause as always convenience comes for a price.



This is what I ended up doing and it works nicely. Actually, the login manager invokes the Xsession script in /etc/X11/Xfce to start Xfce4, so that's where startup and stop happens.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum