Friday, February 24, 2012

Auto login and startx in Backtrack 5

Let's face it, we all use tty1 to login as root/toor and launch startx... so why not boot automatically into our favorite desktop environment? In the following lines I'll explain how to achieve this in three simple steps.

Step 1: Install mingetty.
We need a small application that allows us to auto login as the user that we want. There are severals apps in the repositories to do this task. In fact, you can write your own app to do this in C like many tutorials suggest on the Internet. I'll use mingetty.

apt-get install mingetty

Step 2: Configuration of tty1
Now we need to change the behaviour of tty1 to use mingetty instead of the standard getty. To achieve this we need to edit the file /etc/init/tty1.conf, so use your favourite editor. I'll use nano.

nano /etc/init/tty1.conf

Let's comment out the getty line so it looks like this:

#exec /sbin/getty -8 38400 tty1

Just below this commented line, add the following one:

exec /sbin/mingetty --autologin root --noclear tty1

Save and close the file.

Step 3: startx right after login
The last thing we need to do is launch the startx command just after the login. To do this we need to edit the file /root/.bash_profile. Everything we write in this file is going to be executed just after the root logs in. By default there is no such file in BT5 installation but maybe you added some useful command for you and you want to keep it, so we are going to run the following command:

echo "startx" >> ~/.bash_profile

Done. Restart to see it working.

Enjoy.

No comments:

Post a Comment