Many friends on car pc forum ask how to perform auto login for their Linux box in console mode. I never solve it until this day during packaging mingetty for klixs and read the man page. Ooh boy, it’s already there for so long and never realize it can be solve using mingetty.
Let’s get started.
Step 1: Install mingetty
The first step is to install the a program called mingetty which we will use instead of the regular “getty” which is responsible for generating the login console. If you we’re on KLIXs there are no easier steps than launching synaptic and grab mingetty. Once it installed you are no longer need getty package.
Step 2: Edit inittab file
Now we will edit the inittab file:
# nano /etc/inittab
and change the line
1:2345:respawn:/sbin/getty 38400 tty1
to
1:2345:respawn:/sbin/mingetty --autologin <user-name> --noclear tty1
You can replace <user-name> with either “root” or with your own user-name, and of course you can omit the noclear option if you don’t want to see a boot message.
Example:
1:2345:respawn:/sbin/mingetty --autologin root --noclear tty1
Note: It’s a good idea to make a backup of inittab file first.
save and quite the file.
Step 3: Restart your system
# shutdown -r now
Simply restart your system and will be automatically taken to the bash shell prompt without entering the username and password.
Step 4: Make other tty autologin also (optional)
You must have notice that by default Debian Linux generate 6 tty based login console which you can switch to with “Alt-F2″, “Alt-F3″, “Alt-F4″, etc.
So far we have just made tty1 console (default) autologin enabled. What if you want to make all ttys or some ttys autologin just like tty1? It’s very simple. Edit the /etc/inittab file and to make tty2 autologin:
replace the line
2:23:respawn:/sbin/getty 38400 tty2
with
2:23:respawn:/sbin/mingetty --autologin root --noclear tty2
And similarly you can do for tty3, tty4, and so on.
Happy Autologin.