HOWTO: Enable console autologin on Ubuntu

This entry explains how you can automatically login to your Ubuntu machine. Warning: the following is a security hazard on network attached and publicly accessible machines.
On throwaway development boxes, on the other hand, you sometimes need to reboot often and want to skip the annoying login. Only use this on inherently private machines: those that are physically secure and disconnected from the internet.


Traditional Linux

On traditionally configured linux machines, download mingetty from sourceforge, compile and install it and then edit /etc/inittab. For each console, replace lines such as

1:1:respawn:/etc/getty 9600 tty

with

1:1:respawn:/sbin/mingetty --autologin USERNAME tty1

To be automatically presented with a logged-in console on boot, also disable your graphical login managers. These are usually active on console 7.


Ubuntu

Ubuntu sometimes deviates from standard practice; the boot process is one example. First, to install mingetty, just run

sudo apt-get install mingetty

Ubuntu 9.04 inittab

Then, update the replacement of inittab. On Ubuntu 9.04, this file is replaced by a series of files in /etc/event.d. To automatically login on console tty1, edit /etc/event.d/tty1. Replace the use of getty in the last line from

exec /sbin/getty 38400 tty1

to

exec /sbin/mingetty --autologin USERNAME tty1

To automatically login on other consoles, be sure to replace tty1 with the correct name of the console.


Ubuntu 10.04 inittab

Ubuntu also changes its init process occasionally. In 10.04, the file /etc/event.d/tty1 is replaced by /etc/init/tty1.conf. The changes are similar to those explained above.

Comments

  1. Works fine in Ubuntu 12.04.3
    Thank you very much :)

    ReplyDelete

Post a Comment