Python app as a Display Manager

"Martin v. Löwis" martin at v.loewis.de
Sun Jul 1 14:28:57 CEST 2007


> I feel at this stage that what I miss is: assuming I manage to get a
> python-based dialog box started automatically from init.rc (instead of xdm,
> gdm, ...): how do I start an X11 session with the user/pw information
> retrieved ... + set the correct *nix environment variables.

First, the user will enter username and password into your dialog box.
You need to verify this, either by using the pwd module, or by using PAM
(through python-pam).

Then you need start a session. Fork a subprocess, and use setuid/setgid
to take the identity of the subprocess. In the parent process, wait for
this child process to terminate, then display your dialog again (perhaps
restarting the X server in-between).

What you do in your session is your own choice. It is custom to set a
few environment variables, and then run /etc/X11/Xsession (or whereever
the standard X11 session script lives); the latter is done through exec,
i.e. when Xsession returns, the user has chosen to logout.

This is the basic working principle; different display managers deviate
in how precisely they setup the session, and what precisely they run in
what order.

However, this entire discussion is off-topic for comp.lang.python;
please ask on comp.windows.x instead.

HTH,
Martin



More information about the Python-list mailing list