Re: Running one Python program from another as a different user



"dwelch91@xxxxxxxxx" <dwelch91@xxxxxxxxx> writes:

> Greetings-
> This is on Linux... I have a daemon running as root and I want to
> execute another Python program as another user (a regular user). I have
> the name of the user and can use the 'pwd' and 'grp' modules to get
> that user's user and group ids. What I don't understand is how to then
> go about launching that new program. I had considered having the
> launched program switch itself back to the target user (somehow), but
> the launched program is graphical in nature (PyQt), and I am afraid of
> X11 locking out the display to user root (many distros seem to ship
> with server access for user root turned off). That might prevent the
> launched program from even starting?
>
> Any ideas? My Google searching was not successful in figuring this
> out...

Well, Jeff already pointed out running su. You might also check the
os.setuid docs, and the setuid man page.

<mike
--
Mike Meyer <mwm@xxxxxxxxx> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
.



Relevant Pages

  • Re: Running one Python program from another as a different user
    ... I have a daemon running as root and I want to execute another Python program as another user (a regular user). ... I had considered having the launched program switch itself back to the target user, but the launched program is graphical in nature, and I am afraid of X11 locking out the display to user root. ...
    (comp.lang.python)
  • Running one Python program from another as a different user
    ... execute another Python program as another user (a regular user). ... the launched program is graphical in nature, ... X11 locking out the display to user root (many distros seem to ship ...
    (comp.lang.python)
  • Re: syslogd(8) Dropping Privs
    ... >less daemon running as root seems like a Good Thing. ... One consideration is that if syslogd is not running as root, ... On systems where non-root users can write to the filesystem ...
    (FreeBSD-Security)
  • Re: syslogd(8) Dropping Privs
    ... >>less daemon running as root seems like a Good Thing. ... > it will no longer be able to write to a filesystem which is ... syslogd with disk space. ...
    (FreeBSD-Security)
  • Re: syslogd(8) Dropping Privs
    ... On Fri, 4 Jun 2004, Crist J. Clark wrote: ... > less daemon running as root seems like a Good Thing. ... > see any drawbacks from a security point of view. ...
    (FreeBSD-Security)