Skip to content

Just another Linux geek

Linux, automation and open source

  • About
  • Articles
  • RSS

Just another Linux geek

Linux, automation and open source

  • About
  • Articles
  • RSS

Auto login user with X environment under Debian

By Chris28 May, 200927 October, 2026Desktop software, Linux, Open source

I am building a Digital Preservation Recorder live CD for work and have successfully done so using Arch Linux. Now I wanted to try Debian and see how it compares.

I want the Live CD to boot and automatically log my user into a graphical environment, and I want to do that using the least amount of resources. I installed Squeeze, including LXDE for my graphical environment. This pulled in the GNOME Desktop Manager by default, which I don’t want, so I removed it.

Shell
Copy
sudo apt-get remove --purge gdm

My plan was to simply edit the inittab and tell it to start up X on a new terminal, so I did this first.

Shell
Copy
sudo vim /etc/inittab

The default run level for Debian is 3, so under the line:

Shell
Copy
6:23:respawn:/sbin/getty 38400 tty6

I set the following line:

Shell
Copy
7:3:once:/bin/su - user -l -c "/bin/bash --login -c startx" &>/dev/null

The command basically says to switch root to my user, “user”, and execute the startx command from a bash session.

Running the command “startx” will of course start the X server, but I need to tell it what environment to load. To do this, I created an .xinitrc in my user’s home directory.

Shell
Copy
echo "exec startlxde" > ~/.xinitrc

Unfortunately, upon a reboot X wouldn’t start. It took a little while to work out why this wasn’t working as I expected. Turns out that Debian limits who can start an X session, so I had to edit the file /etc/X11/Xwrapper.config and set allowed_users=anybody rather than just “root”.

This can also be achieved by running:

Shell
Copy
sudo dpkg-reconfigure x11-common

The only issue I have at the moment is that logging out of LXDE and selecting “Restart” or “Shutdown” from the menu does not actually perform said task. I’m assuming this is because my user doesn’t have permissions to do so, as X was not started by root. Well, time to fix that next 🙂

-c

autodebianinittablive cdloginxlde

Post navigation

Killer KDE Kombo Komplete?
KDE 4: The Komplete Desktop?

You might also like:

A yellow Ethernet cable and RJ45 connector
20 October, 20223 November, 2026

Making a systemd service which binds to an IP start on boot

A close-up of rack-mounted Cisco servers at the Wikimedia Foundation
3 April, 20223 November, 2026

Using a dynamic libvirt inventory with Ansible

The green Element chat logo
21 March, 202228 October, 2026

Joining a bridged IRC network on Element (Matrix)

© 2026 Just another Linux geek

Just another Linux geek

Linux, automation and open source

Close menu
  • About
  • Articles
  • RSS