Is there any problem I didn't notice using a shell script instead of C? Seems to work for me:
/etc/inittab:
Code:
c1:1235:respawn:/sbin/agetty -l /path/to/autologin.sh -n 38400 tty1 linux
autologin.sh:
Code:
#!/bin/sh
exec /bin/login -f username
I'd use the above for good measure, but is it any better then just
/etc/inittab:
Code:
c1:1235:respawn:/bin/su - username
?
EDIT3: This is probably useless, since su starts a shell but doesn't open a tty port. Maybe a -c option can be added to start x or something.
EDIT: What's the difference between:
Code:
exec /bin/login -f username
and
Code:
exec /bin/login -- username #this is what agetty does by default
?
I didn't notice any difference: if one asks for password so does the other and vice-versa (according to /etc/login.defs NO_PASSWORD_CONSOLE item and presence of password).
Is the -f option related to pam? I don't have pam installed.
EDIT2: If someone finds it inconvenient that you can't logout without being immediately relogged in, you can use the action "once" instead of "respawn" in the inittab entry.
If you don't want the tty to become useless after logout you can use a "wait" entry for the autologin, followed by the default "respawn" entry, both at the end of inittab:
Code:
a1:1235:wait:/sbin/agetty -l /path/to/autologin.sh -n 38400 tty1 linux
c1:1235:respawn:/sbin/agetty 38400 tty1 linux