Sections

  • About Author
  • Contact
  • Debian Hosting
  • Popular Posts
  • Privacy Policy
  • Sitemap

Debian Admin

Debian/Ubuntu Linux System Administration Tutorials,Howtos,Tips

Categories

  • Backup
  • Database
  • Free-Tools
  • General
  • Monitoring
  • Network
  • Other Linux
  • Package-Mgmt
  • Paloalto Firewalls
  • Security
  • Webserver

How to auto login and startx without a display manager in Debian

Posted on December 23, 2008 by ruchi 12 Comments

If you want to auto login and startx without a display manager in Debian use the one of the following method

Method 1

First you need to edit the /etc/inittab file

#nano /etc/inittab

look for the following line

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

and commentout

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

add the following line

1:2345:respawn:/bin/login -f YOUR_USER_NAME tty1 </dev/tty1 >/dev/tty1 2>&1

Save and exit the file

Now you need to edit .bash_profile and at the bottom add  the following command and save

startx

Method 2

First install rungetty using the following command

#apt-get install rungetty

you need to edit the /etc/inittab file

#nano /etc/inittab

look for the following line

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

Sponsored Link

Related content:

  1. How to disable X or GUI on boot in Debian
  2. Fix for sleepy display and boot-to-prompt on iMac G3
  3. How to install 4pane file manager in debian Squeeze/Lenny
  4. How to install ATI fglrx drivers in Debian Lenny
  5. How to Add Date And Time To Your Bash History file

Categories: General

Tags: auto login debian, setup auto login debian

12 thoughts on “How to auto login and startx without a display manager in Debian”

  1. anonymous on March 18, 2009 at 4:13 pm said:

    Method 2:
    while; true
    do

    You forgot about `;` after “while”.

  2. tawan on July 25, 2009 at 12:12 pm said:

    Great, I had a hunch you could do this and so happy you can. Method 1 worked perfectly, thank you.

  3. Tim on January 13, 2010 at 5:03 pm said:

    Sorry, but neither of these methods work on my Debian machine. I wish I could elaborate on why, but I am not familiar enough with these lower level workings. Could be that I am still using Etch.

    For method 1: It booted normally and prompted me to login at the graphical interface as usual. I logged in on the account chosen for the example and several of the gnome panel applets crashed.

    For method 2: It booted normally and prompted me to login at the graphical interface as usual. I logged in on the account chosen for the example and the GUI hung and I had to undo the changes in the console.

  4. Dan on August 8, 2010 at 11:08 am said:

    Hi, My keyboard input won’t work when I modify my inittab with “1:2345:respawn:/bin/login -f YOUR_USER_NAME tty1 /dev/tty1 2>&1”, what could i be doing wrong? I’m not starting X, all I want is autologin leaving me in a terminal.

  5. eev on November 24, 2010 at 3:48 pm said:

    where the hell the .bash_profile is?

  6. undead_rattler on December 17, 2010 at 4:52 pm said:

    @Tim You appear to have a conflicting X manager installed. Check for XDM, GDM, or KDM in your /bin, /usr/bin, /sbin, or /usr/sbin directories. Use “apt-get –remove PACKAGE-NAME-HERE” to remove them.

    @Dan You’re not getting any keyboard input because the way you’ve edited the file looks like it’s sending Standard in (kbd/mouse) and Standard out (display for bash/fish/sh/etc) to null. try taking out the “2>&1” at the end.

    @eev this is a (hidden) file stored in your home directory (/home/USERNAME/) that you might have to create yourself. A simple google search should do you well 🙂

  7. alex on July 12, 2011 at 1:40 pm said:

    oh my god
    guys, you rule!!
    thanks!!

  8. captain obvious on August 11, 2011 at 3:05 pm said:

    You can get owned by an attacker pressing ctrl+c on tty1…

  9. Bob on October 29, 2011 at 11:16 am said:

    @captain obvious

    You could install screen then alter your .bashrc to look like this:

    if [ -z “$DISPLAY” ] && [ $(tty) = /dev/tty1 ]; then
    screen -d -m startx && logout
    fi

  10. chetan on January 1, 2012 at 2:47 pm said:

    x:23:once:/sbin/rungetty -u root -g root tty9 — /bin/su creddy -l -c “xinit > /tmp/xinit.out 2>&1”

  11. Naeem Ijaz on November 12, 2012 at 7:57 am said:

    where do i will find .bash_profile file ?

  12. Question on October 13, 2014 at 10:39 am said:

    Where do I find .bash_profile

Leave a comment

Your email address will not be published. Required fields are marked *

« How to Install Adobe Flash in Debian Etch/Lenny/Sid
HowTo upgrade from Debian Etch (4.0 ) to Lenny (5.0) »

Sponsored Link

    Cheap Web Hosting

Categories

  • Backup
  • Database
  • Free-Tools
  • General
  • Monitoring
  • Network
  • Other Linux
  • Package-Mgmt
  • Paloalto Firewalls
  • Security
  • Webserver

Sponsored Link

Archives

Sponsored Link

Favourite Sites

Ubuntu Geek
  • About Author
  • Contact
  • Debian Hosting
  • Popular Posts
  • Privacy Policy
  • Sitemap