Automatic root login in Debian 6.0 without GUI (xserver)

Is there any simple and straightforward way in which I can set my Debian 6.0 box to automatically login, at startup, with the root account on the console?

There is no GUI (xserver) installed on the machine.


Solution 1:

I don't have a Debian install handy, but this method works for Slackware and should apply just as well to any system which uses inittab.

As root, edit the file /etc/inittab. Find a line that looks something like the following:

c1:1235:respawn:/sbin/agetty 38400 tty1 linux

Replace that line with (or better yet, comment it out and add) one which reads as follows:

c1:1235:respawn:/sbin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1 

Save the file and reboot.

Solution 2:

You can enable the autologin by modifying the inittab file.

Using any editor Open the file inittab. I have used vim editor

#vim /etc/inittab

Serach for the line.

1:2345:respawn:/sbin/getty 38400 tty1

Replace with as follow

1:2345:respawn:/sbin/mingetty --autologin <user-name>  --noclear tty1

After modifying the inittab restart the system.

Note: before modifying the inittab, keep the backup of it.

Solution 3:

Both answers from here didn't work on my os,

I use CUBIAN which is an Debian wheezy based os for ARMv7 on Cubieboard

and my solution (working for me) is using rungetty :

install rungetty

edit /etc/inittab

comment out

1:2345:respawn:/sbin/getty 38400 tty1 

and add

1:2345:respawn:/sbin/rungetty tty1 --autologin YOUR_USER_NAME

edit .bash_profile and at the bottom add

if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty1 ]; then
while true
do
startx --
sleep 10
done
fi

then it worked !

Thanks to MeanDean on Debian user forum.