XFCE Auto Login
- 0 comments

I use XFCE with openSUSE on my laptop because it is lightweight and leaves more of my limited RAM for applications than some of the fancier GUIs such as Gnome or KDE while still enabling me to do everything I need to do such as watch videos, use GIMP, Quanta+, Firefox, and do my books with KMyMoney.

XFCE usually uses XDM as the login manager however I did not feel that the minimal security provided by a user name and password outweighed the inconvenience and delay of having to load a login manager and enter my credentials into it.

It is usually a good idea to make a backup of any files before editing them; especially when you don't really understand the contents of the file well enough to (re)create it from scratch. Usually I just create a copy of the file to be edited and place it in the same folder as the source with ".bak" appended to it. I often like to work from a temporary folder as well where I can make a mess which can easily be cleaned up by deleting the entire folder when I am finished.

First I switch to being root, create a temporary folder, and create a backup of the two files I am going to modify into my temporary folder. I remove the leading ".' from the one filename, which causes the file to be hidden, to make it easier to find if I need to restore it.

Replace with the user name of the account which you want to have automatically logged in.
Lines beginning with $ should be done as the user I just mentioned. Lines beginning with # should be done as root.

$ sudo su
# cd
# mkdir temp
# cd temp
# cp /etc/inittab ./
# cp /home//.bash_profile ./bash_profile

Next I will edit /etc/inittab and change
1:2345:respawn:/sbin/mingetty --noclear tty1
to
1:2345:respawn:/sbin/mingetty --autologin tty1

Now I will switch to being and edit, or create if missing, the .bash_profile file. I am using vim here but you can use whatever editor you like. I am not going to show the commands used within vim so if you are not familiar with vim then I suggest using a graphical text editor such as KWrite or Gedit.

# su
$ cd
vim .bash_profile

Add the following three lines:

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
startxfce4
fi

The last step is to disable XDM. I will return to being the root user and either use yast or vim to edit the appropriate /etc/sysconfig file.

$ exit

Using yast go to...
System > /etc/sysconfig Editor > Desktop > Display manager > DISPLAYMANAGER
..and change the "Setting of: DISPLAYMANAGER" to "console" from "xdm" or whatever it was (prehaps gdm,kdm, or a few others).

Using vim edit /etc/sysconfig/displaymanager and change
DISPLAYMANAGER="xdm"
to
DISPLAYMANAGER="console"

Restart your computer and hopefully enjoy an automatic login. I realize these instruction are a little unclear and don't really follow best practices for documentation so feel free to correct them or ask for help in the comments (below).

Sources:
http://ubuntuforums.org/showthread.php?t=152274
http://www.cs.rit.edu/~css8044/?q=autologin
http://linux.derkeiler.com/Newsgroups/comp.os.linux.x/2003-07/0373.html