Thursday, September 30, 2010

Auto login Ubuntu user from CLI


There are a lot of recipes out there on how to automatically login into a given Linux user's account on start up, but most of them rely on some sort of graphical environment or display manager to be present. It took me quite a bit of digging to find a way to auto login in Ubuntu with nothing but CLI. I'm sure others will find this tip useful.

To auto login user "bob" on first console terminal (tty1) edit file /etc/init/tty1.conf and replace last line:

exec /sbin/getty -8 38400 tty1

with this:

exec /bin/login -f bob < /dev/tty1 > /dev/tty1 2>&1

and Robert's your father's brother, next time you boot your machine bob will automatically log into his account on tty1.