Sunday, 14 September 2008, 17:23:47 EDT
Several months ago I built a MythTV computer. Since I built it during spring semester I didn't really have the time to fully configure the machine. So it's been in a usable but needs work state ever since. One of the biggest problems was getting the machine to boot into the MythTV frontend application without requiring a login every time. The GNOME Display Manager would allow me to specify an automatic login, but that only works for the first login. So if I had to quit the MythTV frontend for some reason, GDM would automatically come back up, but then ask for a username and password. SLiM recently (as in 9/7/2008) added support for an automatic login, but it also only works for the first login. This seems to be the way of things for this type of application. They will automatically login a user the first time, but not subsequent times, and there is no way to make the programs quit after one execution.
This situation was unacceptable to me. I needed a login manager that would do three simple things:
- Automatically login a chosen user.
- Grant the user privileges as defined by PAM.
- Quit execution when the X session was quit.
Since I could not find such a simple program, I wrote my own. In my code section you can find the source code to a program "mythlogin".
Why not just execute xinit directly from inittab? As of Linux kernel 2.6.24 it is necessary to establish privileges through PAM in order to be able to run processes at realtime priority. Prior to 2.6.24 you merely had to set the user id bit on a binary to zero and the application could escalate itself to realtime priority. Now, though, you must explicitly give the user the authority to set processes as realtime. So you can't just directly init X from inittab and expect an application like mythfrontend to be able to enter realtime priority mode. By using a login application that authenticates, or at least starts an "authenticated" session, via PAM you are able to get these privileges for your user.
Categories:
- linux
- code
- HTPC