Automatically Start X with GDM in BackTrack 5



I’ve heard about BT5 a while ago, but since it’s also a Debian-based distro and I’ve been using Debian-based Linux distributions for like one-third of my life, I was reluctant. Until a couple of weeks ago, after a friend told me that it comes out-of-the-box with tons of InfoSec tools I’ve decided to give it a try just to see what it really can do. So I downloaded and install it in VirtualBox to give it a test-run.

My first impression was it’s like Arch Linux. By default, you’d be booted up on a Tty and you have to manually login as ‘root,’ with ‘toor’ as the default root password Then you have to run ‘startx’ so you can have a graphical interface – the BT5 way. It’s pretty simple actually, but I don’t think it’s a very good idea for any smart Linux user to run it’s entire system as root all the time. You might destroy your important system files before you know it.
So in this tutorial let me share to you how I created a sudoer (regular user) account in a fresh installed BT5. And then we will try and install Gnome Desktop Manager (GDM) because Gnome is the default desktop environment pre-installed in BT5.
OK, first we need to make a sudoer. It’s actually very simple. Simply fire up your Terminal and then run the following command (assuming that you don’t have a user account yet, so we’re doing the entire process as root):
For this example, we are going to use ‘homer125‘ as our test username.

# useradd -m -g users -G admin,video,disk,games,cdrom -s /bin/bash homer125
Then we need to add a password to your username:
# passwd homer125
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
After we have created a sudoer, we’re going to install GDM, so we can boot up and login directly using the username (homer125) we’ve just created. To install GDM simply run this command in your Terminal:

# apt-get install gdm

Now we need to test GDM and see if it’s working the way it should. To run GDM simply run this command:
# gdm
If GDM is working the way it should, you should see the good old Gnome login screen. Let me remind you , the default login screen is quite ugly so you gonna have to be patient about it, you can change it though if you want to. Now, try to login using your new username. If you see no problem, restart your computer and then login again as root in Tty. This time we’re going to automate GDM so you won’t have to login as root everytime you boot up before you can go the the graphical interface.
To do just that, you have to edit /etc/init/gdm.conf using vim (or nano). I suggest you create a backup of your gdm.conf file first, just in case you run into trouble along the way.
# cp /etc/init/gdm.conf /etc/init/gdm.conf.backup
# cd vim /etc/init/gdm.conf
By default this is what gdm.conf file in BT5 looks like:
# gdm – GNOME Display Manager
#
# The display manager service manages the X servers running on the
# system, providing login and auto-login services
description “GNOME Display Manager”
author “William Jon McCann “
start on (filesystem
and started dbus
and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
or stopped udevtrigger))
stop on runlevel [016]
emits starting-dm
env XORGCONFIG=/etc/X11/xorg.conf
script
if [ -n “$UPSTART_EVENTS” ]
then
[ ! -f /etc/X11/default-display-manager -o “$(cat /etc/X11/default-display-manager 2>/dev/null)” = “/usr/sbin/gdm” ] || { stop; exit 0; }
# Check kernel command-line for inhibitors
for ARG in $(cat /proc/cmdline)
do
case “${ARG}” in
text|-s|s|S|single)
plymouth quit || : # We have the ball here
exit 0
;;
esac
done
fi
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG LANGUAGE
elif [ -r /etc/environment ]; then
. /etc/environment
export LANG LANGUAGE
fi
export XORGCONFIG
exec gdm-binary $CONFIG_FILE
end script
Highlighted in orange are the codes that you need to remove for you to be able to automate GDM at bootup. Once you have trimmed the code, your gdm.conf file should now look exactly like this:
# gdm – GNOME Display Manager
#
# The display manager service manages the X servers running on the
# system, providing login and auto-login services
description “GNOME Display Manager”
author “William Jon McCann “
start on (filesystem
and started dbus
and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
or stopped udevtrigger))
stop on runlevel [016]
emits starting-dm
env XORGCONFIG=/etc/X11/xorg.conf
script
export XORGCONFIG
exec gdm-binary $CONFIG_FILE
end script
Now, restart your computer.

You should now be able to run X and login with your new username via GDM automatically. I’ve only used BT5 for like 2 days, but I think I’m going to like it.
Happy BackTracking! Cheers 🙂

.

2 thoughts on “Automatically Start X with GDM in BackTrack 5

  1. “It's pretty simple actually, but I don't think it's a very good idea for any smart Linux user to run it's entire system as root all the time.”

    Not to be critical, but that's like saying you shouldn't drive your car at 180km/h all the time as you might crash. The folks who tend to drive at those speeds tend to be expert drivers, just as the folks using Backtrack Linux tend to know what they're doing.

    This is a distro for competent admins who require the Infosec tools, and most of these tools need root to function. Accordingly, if a user isn't competent enough not to get themselves into trouble as root, perhaps they should leave backtrack for a bit, focusing instead on kubuntu. They can always come back to it when they are competent.

    Proclaiming that 'root' should be avoided however, is a popular gospel, but a fallacious one.

    Like

  2. Still, some people prefer not to drive at 180 km/h just in case they make a stupid mistake, so that any possible damage will be somewhat limited. In the same way, there are those -no matter how much of an expert they are- who will prefer not to run everything as root, just in case they make a stupid mistake.

    Still, I agree that root should not be avoided at all costs, as some people seem to believe.

    Like

Leave a comment