I use a collection of virtual machines in parallels for a number of things, like testing SQLEditor and running web apps that would otherwise require lots of software dependencies. However I’ve been getting tired of logging in to my linux virtual machines all the time. If it were just a case of ssh then obviously I could set up ssh key pairs and do auto-login, but I also need direct terminal access too, in this case in the main parallels window.
With a physical machine to get autologin in this situation would mean that the machine would boot and immediately log the user in without interaction.
Important Warning
This represents some security risk. You need to consider your circumstances carefully first to ensure that this will not open your machine to malicious use.
(Of course there is always the point that if someone has physical access to your machine then there’s not much hope anyway. But still …)
Fortunately this is possible and actually quite easy if you don’t mind editing a configuration file.
The file you need is /etc/inittab
Important Warning (2)
/etc/inittab
is vital to the operation of your machine. Incorrect editing will cause a number of problems.
If you are making these changes to a virtual machine simply make another. Alternatively try logging in via ssh to undo the changes.
The change you need to make is to find the line that looks like:
1:2345:respawn:/sbin/mingetty tty1
and change it to look like this (where username is the user that you want to autologin as)
1:2345:respawn:/sbin/mingetty --autologin username tty1
The original source of this is EasyMameCab; which looks like a clever idea in itself. They are using linux as the base system for building a video game cabinet, so obviously they don’t want logins appearing.
In case of any problems, first try to switch to another tty – just press Alt+F2, login and fix the problem.