Tuesday, August 10, 2010
10:50 AM

How to enable Autologin to Linux console using mingetty

The mingetty program is a lightweight, minimalist getty program foruse only on virtual consoles. Mingetty is not suitable for serial lines (you should use the mgetty program instead for that purpose)

If you got the mingetty program, your /etc/inittab file will look like ....
1:2345:respawn:/sbin/mingetty --noclear tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
The first field says that this is the line for /dev/tty1. The second field says that it applies to run levels 2, 3, 4, and 5. The third field means that the command should be run again, after it exits (so that one can log in, log out, and then log in again). The last field is the command that runs mingetty on the first virtual terminal.

The above series of lines also use the "respawn" option to keep six mingetty processes running on the system. If someone tries to kill one of these processes as root, the process will simply be respawned. Only critical processes are set up in this way to keep them safe from anything else happening on the system.

If you're curious about these processes, check them out on the running system using command

$ ps -ef | grep getty

Now to enable the auto loging for a particular user, edit the /etc/inittab file and identify the terminal on which you want user to have auto login ...
1:12345:respawn:/sbin/mingetty --noclear --autologin username tty1
Reboot the system after making above changes and insure that init has spawned the new version of mingetty, and if all is well, will automatically log you on to the console.

0 comments:

Post a Comment