[issue10032] os.setuid and os.setgid have unexpected influence on serial module

Tjeerd Pinkert report at bugs.python.org
Wed Oct 6 10:10:24 CEST 2010


Tjeerd Pinkert <t.j.pinkert at alumnus.utwente.nl> added the comment:

Indeed I use Linux, sorry for the inconvenience of not mentioning.

Thanks Ned, I think this is indeed the case. Using os.setgroups with a list of group ids (one for the file access, one for the serial port) before switching user with os.setgid, os.setuid solved the problem.
I think os.initgroups(username, gid) does just this, only is not yet available in my distro.

It could be a feature of os that the groups of the user are set on a os.setuid call? Or would this break compatibility with the standard unix library behaviour?

To David: Yes you are right, only it would have cost me quite a bit of time to strip the code, and I tried this code to see if the behaviour was consistent when using other daemon code. Next time I will post my own code.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10032>
_______________________________________


More information about the Python-bugs-list mailing list