Automatically log into Xfce without a login manager

July 13, 2006 at 8:24 am | Posted in tips and tricks, xubuntu | 15 Comments

This has been done countless times before. However, I want to provide a version that doesn’t require messing with gcc and removing xubuntu-desktop. This howto is based off of this message from the Ubuntu Lite group.

1) Install mingetty:
sudo aptitude install mingetty

2) Edit your .bash_profile file. This controls what happens when you log in:

mousepad .bash_profile

And paste this in, at the bottom of the file:

# autologin tty2
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty2 ];
exec startxfce4

Save the file, and exit.

3) Edit /etc/inittab (sudo mousepad /etc/inittab), and replace the following line:

1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2


#1:2345:respawn:/sbin/getty 38400 tty1
2:2345:respawn:/sbin/mingetty --autologin

Obviously, replace YOURUSERNAME with your username. Save the file and exit.

4) Stop GDM from loading on startup. Go to Xfce menu > Services, and uncheck “Graphical Login Manager (gdm)”.

5) Reboot. While this saves RAM, Xfce’s default Quit menu does not work (for me, anyway.) To fix this, create a group that can shutdown your computer:

sudo addgroup shutdown

Then, edit /etc/group:

sudo mousepad /etc/group

Scroll down to the bottom, and write in your username after shutdown:x:1001:.

Then, run

export EDITOR=mousepad && sudo visudo

And paste in:

%shutdown ALL=(root) NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/shutdown

Then, right click the Xfce menu > run, Edit menu, and create shortcuts to gksudo /sbin/halt and gksudo /sbin/reboot. Save your menu, and exit.

Now, your computer will automatically log in, and save some RAM and CPU cycles along the way.


RSS feed for comments on this post. TrackBack URI

  1. […] It’s IceWM with a composite manager, xfce4-terminal and Opera. I got myself set up with IceWM following this guide here: I’m using the IceBuntu theme, and used Icepref to configure it to my liking. I followed the guide here: The Composite Manager Guide: How to Get Vista-ish Effects in (K)(X)Ubuntu to get transparency and shadow effects, and disabled GDM and used Mingetty with my guide. It’s lightning fast! […]

  2. […] 3) Using my login automatically guide, I changed the line startxfce4 to startx in my .bash_profile file. This, along with .xinitrc, automatically logs me into IceWM. […]

  3. Hey! It works just fine. Only problem is that I loose VC1 and VC2.
    HowTo keep VC1..4? Don’t need VC5 & 6.

  4. VC1 is commented so that you don’t see a bunch of text when you log in. I’m not sure why you lose VC2-4, because this guide does nothing to it.

  5. […] Following this guide, you can set up bash to re-start X after you log out, just like a display manager. […]

  6. It might not be as educational, but with xubuntu 7.04 one can simply select “applications” > “settings” > “login window” then choose the “security” tab, check “enable automatic login”, choose the user to be logged in and click “close”.

  7. Charles, thank you for your comment (no joke) I was also about to reinvent the wheel. But as you said the tip above is quite educational and will save time to lot of people.

  8. I tried the above, but after several attempts, couldn’t get it to work. When doing step 4), X crashed, and I was thrown back to the terminal login prompt. Logging back in and typing “startx — :1″ brought me up in GNOME. Restarting and shutting down did not help.

    It might be because my/etc/inittab did not have the lines shown above, or because I am on 7.10, or because I also have KDE and GNOME installed, but I would warn people to be VERY CAREFUL when changing these settings, as they are not for novices! Luckily, I knew enough to get X back, but I think people should take the advice of the warning that appears when you try to uncheck the Graphical Login Manager.

    But thanks for the tips, anyway!

  9. There’s an error in this script:

    2:2345:respawn:/sbin/mingetty –autologin

    1) This line looks like it’s 2 lines – including the br tag in the underlying HTML. It isn’t! It should be all on one line, otherwise you’ll get an error about an id field being too long (referring to “olpc”).

    2) autologin needs 2 dashes in front of it, not one, or mingetty just dies and does nothing, causing an “Error: id “2” respawning too fast” error message forever. So it’s:

    2:2345:respawn:/sbin/mingetty -–autologin YOURUSERNAME tty2

    But, all that does is make the error messages go away so I can boot – it doesn’t autologin for me. There’s either still more that’s wrong with this script, or Xubuntu on OLPC needs more than this in order for autologin to succeed. I end up with a console login prompt.

    A couple tips for those who want to investigate further:

    > man mingetty

    That will pull up the help for mingetty after it’s installed, where you can find things like the proper syntax for autologin.

    Searching for man inittab will give you a run-down on how inittab works (Ubuntu and Xubuntu guides will NOT find you this info).

    2:2345:once:/sbin/mingetty -–autologin YOURUSERNAME tty2

    Changing the line to the above (once instead of respawn) lets you experiment in a way that at least just does nothing if you screw it up, rather than preventing you from booting and hosing your machine. Any line you mess with, use once until you’re SURE it works.

    Good luck.

  10. Got autologin to work on the OLPC XO-1!

    2 more changes:

    1) Change the autlogin line to 1, so that section looks like this:

    #1:2345:respawn:/sbin/getty 38400 tty1
    #2:23:respawn:/sbin/getty 38400 tty2
    1:12345:respawn:/sbin/mingetty –autologin olpc tty1
    3:23:respawn:/sbin/getty 38400 tty3
    4:23:respawn:/sbin/getty 38400 tty4
    5:23:respawn:/sbin/getty 38400 tty5
    6:23:respawn:/sbin/getty 38400 tty6

    Very important to notice that the autologin line ends in “tty1″ not “tty2″.

    2) After editing inittab, reboot using:

    > sudo reboot

    I’m not certain this is required, but reading about this lead me to several blogs saying this was required to “respawn inittab” (?).

    It works!

  11. один из самых интересных порталов в интернете

  12. […] Automatically log into Xfce without a login manager | Xubuntu … […]

  13. […] Automatically log into Xfce without a login manager | Xubuntu … […]

  14. […] Automatically log into Xfce without a login manager | Xubuntu … […]

  15. […] Automatically log into Xfce without a login manager | Xubuntu … […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at | The Pool Theme.
Entries and comments feeds.


Get every new post delivered to your Inbox.

%d bloggers like this: