seeing-things / zwo

ZWO SDK and custom software for debugging and using it.
24 stars 4 forks source link

Make it possible to run capture as regular user #7

Closed bgottula closed 5 years ago

bgottula commented 5 years ago

Capture sets thread priorities to real-time. This requires running it as root. Find a way to allow running this as a normal user.

jgottula commented 5 years ago

This should be pretty easily doable. I think there are packages for automating this sort of thing, but then there's also just stuff like /etc/security/limits.conf to manually edit. I'll come up with something.

bgottula commented 5 years ago

Ideally it would be part of a Makefile or similar. My main concern with editing system config files is that it's impossible to remember what we did in the past, so at some point down the road when it doesn't work anymore I have no clue what we did to make it work in the first place. At the very least we should document any such required edits in the readme.

jgottula commented 5 years ago

Ignore the #7 reference in the commit above; that was an early typo'd version of e312ae4, which was actually meant to refer to #8.

jgottula commented 5 years ago

Well, it's not really feasible/ethical for a Makefile to be able to alter the system settings about which users/groups are allowed realtime privileges...

jgottula commented 5 years ago

For the purposes of documentation, here is how to set up the system to allow anyone to run anything with realtime priority without needing to do so via sudo or as root:

As root, create a new file called /etc/security/limits.d/99-realtime-privileges.conf, with these contents:

* - rtprio  98
* - memlock unlimited

Users need to log in again for it to take effect.

The command ulimit -r (without sudo) will show 98 (i.e. the maximum allowed realtime priority is 98), rather than 0, if the configuration is being applied to the current session.