[plug] Linux auto login

Russell Steicke r.steicke at bom.gov.au
Mon Jan 13 23:19:08 WST 2003


On Mon, Jan 13, 2003 at 04:49:04PM +0800, Jason Smuts wrote:
> 
> 
> > > Hi guys/gals,
> > > 
> > > I have been trying to get a linux box to automatically login as a 
> > > particular (non-root) user.  I have only very limited experience
> with 
> > > Linux so if anyone knows of some magic that could help me here ...
> >
> > If you can run gdm on your system (in runlevel 5), look at the
> AutomaticLogin > or TimedLogin options in /etc/X11/gdm/gdm.conf.
> 
> 'fraid not Russell.  I would prefer not to run a display manager, just
> one application on top of X windows.  I don't want the user to be able
> to do anything but run this custom application.  Unless gdm can be
> trimmed down (no desktop, no window manager, etc).  Any other ideas?

Running a display manager doesn't mean that you have to run the
associated desktop environment.  Give that login a .xsession file that
just runs the embedded app (no desktop, no window manager), and the
users won't be able to start anything else.  (They could do Ctrl-Alt-F1,
login as the embedded user, set DISPLAY=:0, then run other X programs,
but you can prevent that in other ways.)

Or, if you _really_ don't want to use a display manager, you could try
something like this (slightly tested):

/usr/local/bin/run-embedded:

  #!/bin/sh
  chown embedded:embedded /dev/tty8
  openvt -c 8 -w su - embedded -- startx
  sleep 10

/etc/inittab:

  em:3:respawn:/usr/local/bin/run-embedded

where "embedded" is the name of the user that runs your app.  openvt
runs a command with its stdin, stdout and stderr directed to the console
specified ("-c 8").  sleep 10 is to make sure that the thing doesn't
respawn too quickly if it fails, giving you a chance to login and change
runlevel.  You may have to experiment with vt numbers to make sure that
X has a free one to start on.

> How does gdm achieve its auto login?

gdm runs as root, so it can do anything!  It would run
/etc/X11/xdm/Xsession as that user, just like it does when you login.



-- 
Russell Steicke

-- Fortune says:
Question: Is it better to abide by the rules until they're changed or
help speed the change by breaking them?



More information about the plug mailing list