I have been thinking about console (terminal) autologin. My interest is in serial consoles particularly but I've tried to come to a solution that handles serial and vga virtual terminals the same...
I'm basing this on an old implementation of mine: ========================== = from http://lists.gnu.org/archive/html/adr-devel/2004-09/msg00002.html ========================== I modify /etc/inittab to include the lines: 1:2345:respawn:/sbin/getty -n -l /sbin/rootshell 38400 tty1 T0:23:respawn:/sbin/serialrootshell and have --8<-- (/sbin/rootshell) #!/bin/sh exec /bin/login -f root --8<-- --8<-- (/sbin/serialrootshell) #!/bin/sh speed=`stty speed --file=/dev/ttyS0` exec /sbin/getty -n -l /sbin/rootshell -L ttyS0 $speed vt100 --8<-- This ensures a root shell on the console and serial port ========================== This idea needs modifying for the casper environment... for example I don't want a rootshell but a user shell. My new casper version of this idea is as follows: replace all (active) instances of "/sbin/getty " in /etc/inittab with "/sbin/casper-getty ". #run this out of casper-bottom/23configure_init instead of existing sed line sed -i -e'/^[^#]/s%respawn:/sbin/getty%respawn:/sbin/casper-getty%' /etc/inittab have /sbin/casper-getty look like: ---8<---(/sbin/casper-getty)---8<--- #!/bin/sh autologin=1 for opt in $* ; do if [ "$opt" = "-l" -o "$opt" = "-n"] ; then autologin=0 fi done if [ "$autologin" = "1" ] ; then exec /sbin/getty -n -l /sbin/casper-login $* else exec /sbin/getty $* fi ---8<------8<------8<------8<------8<--- Have /sbin/casper-login look SOMETHING like: ---8<---(/sbin/casper-login)---8<--- #/bin/sh exec /sbin/login -f $USERNAME ---8<------8<------8<------8<------8<--- However I can't see that $USERNAME is passed from the casper initramfs to the final system... Perhaps the casper.conf from the root of the debian source could be _installed_ in /etc/intiramfs-tools/conf.d/ and the casper-bottom scripts could copy this to /etc/casper.conf of the booted system.... Then /sbin/casper-login could look like: ---8<---(/sbin/casper-login)---8<--- #/bin/sh USERNAME=root [ -f /etc/casper.conf] && . /etc/casper.conf exec /sbin/login -f $USERNAME ---8<------8<------8<------8<------8<--- This idea should work for any(most?!?) standard getty lines in /etc/inittab regardless of configuration for virtual console or serial line. This leaves one corner case... when the kernels /dev/console is a serial line due to a "console=" statement on the kernel command line. This can be handled in one of 2 ways: (1) let the admin add a normal serial getty to inittab and let the above idea take care of things! (2) check /proc/cmdline and determin console. If it is a ttyS? device and there is no getty line for that port add one! something like: ---8<--- defconsole=$(sed -e 's%.*console=%console=%' /proc/cmdline) if echo "${defconsole}" | grep -qs console=ttyS; then PORT=$(echo "${defconsole}" | \ sed -e's%^console=%%' -e's%,.*%%') SPEED=$(echo "${defconsole}" | \ sed -e 's%^console=ttyS[0-9]\+,%%' \ -e's%\([0-9]\+\).*%\1%') if ! grep -qs ":respawn:/sbin/getty.*${PORT}" /etc/inittab while true ; do #create a random inittab ID of form letter number ID=$(echo -e $(printf '\%04o' $(($RANDOM/1310 + 65)) \ $(($RANDOM/3640 + 48)) ) ) if ! grep "^${ID}:" /etc/inittab ; then #make sure it is not already in use break fi done echo "${ID}:2345:respawn:/sbin/casper-getty -L ${PORT} ${SPEED} vt100"\ >>/etc/inittab fi fi ---8<--- This above snipped could go in casper-bottom/25configure_init The casper-login and casper-getty could either be written out as cat<<EOF docs in casper-bottom/25configure_init or more properly be installed as part of the casper package. In that case they might more properly go in /usr/lib/casper/ rather than /sbin but I'm not sure about that. I hope I have explained this idea clearly... Any thoughts? Regards Alex Owen -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]