Distribution Independent Auto Login To X:

The first thing people say when you talk about auto logging in to a computer of any kind is "Don't do that, it's dangerous!". What the hell do they know? If I want auto login on a linux box independent of distro that's what I'll do! Anyway, on with it.

Back in the day this was a pretty easy thing to do, some distros came with auto login out of the box, these days, as with many things, it's not quite so easy! Too many distros and developers think they know better than you so they remove functionality from programs willy nilly then when people complain about it, they say "It's a feature." (look at gnome 3, steaming pile of piss that is). These people think thare are leaders in their field but they are just another generation standing on the shoulders of the one before beleiveing that they are making a difference. They are, but it's most a change for the worst!

So, how to enable auto login, first, open /etc/inittab (ahh, do you use a distro with systemd?? You can stop reading here and find another way) and modify one of the lines that looks like this:

c3:12345:respawn:/sbin/agetty 38400 tty3 linux

To look like this:

c3:12345:respawn:/sbin/agetty --autologin USERNAME tty3

where USERNAME is the user you want to autologin (if you are too stupid to work that out you should probably stick to windows) Now we need to create/alter the users .bash_profile script to actually start X (.bash_profile is the login startup script, it runs when you login to a tty):

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

That should be it! You should now be able to reboot and automatically login as the user you specified in /etc/inittab.

NOTE/WARNING:While I may have been a bit blunt at the start of this article with regards to the "Don't do that, it's dangerous!" this is a bit of a wicked thing to do, it leaves your box wide open so just bare that in mind when you decide what you are going to keep on this particular profile!!!


Add Comment

Poster Name / Handle / Email:

Comment

Add the words "cant ship"


Back