Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
If I may pry: why? – Daniel Andersson Apr 3 '12 at 7:02
@Daniel: it's a homework project demo virtual machine, I have to send it to my professor, and he is like "please don't bother me with login credentials" – gd1 Apr 3 '12 at 7:39
You may also find funny that root password is "password" – gd1 Apr 3 '12 at 8:41
up vote 3 down vote accepted

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.

share|improve this answer
I made a little correction: 1:1235:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1 it works. thank you – gd1 Apr 3 '12 at 8:17
Nice, this works for me. In the interest of learning, what does this line actually mean? @goldPseudo – lppier Nov 4 '14 at 1:02
@lppier This inittab line just tells the first console ("c1:"), when initialized under runlevels 1, 2, 3 or 5 (":1235:") to run the command "/sbin/login -f root...2>&1" (force login without password) instead of "/sbin/agetty...linux", and to restart the process whenever it's terminated (":respawn:"). The whole "</dev/tty1 >/dev/tty1 2>&1" bit is to force the session input and output to go through the console (which IIRC was necessary for reasons), but I honestly have no idea why that first "tty1" is in there :/ You should be able to man inittab and man login for further details. – goldPseudo Nov 4 '14 at 1:41
I don't think the first tty1 does anything. I removed it and nothing changed. – lppier Apr 23 '15 at 3:03

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.

share|improve this answer
Actually, I accepted the other answer just because it is more similar to the solution I actually applied. Nevertheless, I'm sure your solution is good as well as the other. +1 – gd1 Apr 3 '12 at 8:18

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
startx --
sleep 10

then it worked !

Thanks to MeanDean on Debian user forum.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .