[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: annoucement: auto-login patch for xdm



> > due to a relatively popular demand on such a (mis-)feature at debian-user,
> > i became interested in automatic login, too.
> 
> Just a stupid question, why are ppl using xdm in the first place if they
> want an auto login? Whats wrong with using startx instead?!
> 
i've written a auto-loging script first, which uses startx (see
attachement). but this has a few disadvantages:
1) it will _always_ log on the default user again, if he exits the x
session. so you have no chance to make a "clean" shutdown, because there
is always a xsession running (my script uses an ugly hack for solving
this problem; look at the STSFILE part). and: nobody else can log on
(aside from a textual login an then startx).
2) it does not support XDMCP. you would have to run xdm without own
x-servers configured. that sucks. ok - most people do not need xdmcp
anyway ...
3) ... hmmm ... other ideas? <g>

regards

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
If Windows is the answer, I want the problems back!
#!/bin/sh
# /etc/init.d/autologon
#
#   log on the first regular user in the passwd file automatically

PATH=/bin:/usr/bin:/sbin:/usr/sbin
STSFILE=/var/run/autologon

case "$1" in
  start)
    . /etc/adduser.conf
    export USER=`awk -F: '$3=='$FIRST_UID' {print $1}' /etc/passwd`
    echo -n "Logging in $USER: "
    { test -d /etc/X11/kdm && DISPMAN=kdm; } ||
      { test -d /etc/X11/gdm && DISPMAN=gdm; } ||
      { test -d /etc/X11/xdm && DISPMAN=xdm; } ||
      { echo no display manager configuration found; exit 1; }

#/^DisplayManager\*session/ {print "XSESS=" $2 ";"}
    eval `awk '
/^DisplayManager._0.startup/ {print "XSTRTUP=" $2 ";"}
/^DisplayManager._0.reset/ {print "XRSET=" $2 ";"}
/^DisplayManager\*userPath/ {print "export PATH=" $2 ";"}
' /etc/X11/$DISPMAN/$DISPMAN-config`
    export DISPLAY=:0
    (
	echo rerun >$STSFILE
	chmod 600 $STSFILE
	chown $USER $STSFILE
	while test -s $STSFILE; do
	    $XSTRTUP
	    su - $USER -c 'exec startx $(<$HOME/.wmrc) >$HOME/.X.err 2>&1'
	    $XRSET
	done
	exit 0
    ) &
    echo "done."
  ;;

  *)
    echo "Usage: /etc/init.d/autologon {start}"
    exit 1
    ;;
esac

exit 0

Reply to: