Usually Linux provides a graphical login and that works via a login manager (such as slim,xdm,gdm,kdm,etc). Also there exists an alternative that is used for console login: agetty.
To enable auto login in Linux (this is an independent of display manager you might use) all you have to do is to instruct /etc/inittab to not prompt for login but instead to use an existent user and session. This can be achieved like this:
- edit /etc/inittab and search for that line that looks like "c1:12345:respawn:/sbin/agetty 38400 tty1 linux"
- change that line with something like "c1:12345:respawn:/sbin/agetty -n -l /usr/sbin/autologin 38400 tty1 linux"
where auto login is either a bash script or a executable C program which you can create by your own.
Xfce auto login
#!/bin/bash login -f
Set this script as executable chmod +x /usr/sbin/autologin
autologin.c executable C program:
int main() { execlp( "login", "login", "-f", "", 0); }
Compile the above C program using gcc like :
gcc -march=core2 -mtune=core2 -fomit-frame-pointer -o /usr/sbin/autlogin autologin.c strip -s /usr/sbin/autologin
Note: replace -march=core2 and -mtune=core2 above with your custom CPU code.
Also, we have to make sure that
if [ -z "$DISPLAY" ] "" [ $(tty) == /dev/tty1 ]; then startxfce4 fi
Replace startxfce4 with your favourite session starter.
Finally we have to tell Linux that we are not going to use anymore the slim/xdm/gdm/kdm display manager any more but instead the console. So let's edit the /etc/conf.d/xdm (the name depends on the display manager you are using) and change DISPLAYMANAGER="xdm" with DISPLAYMANAGER="console".
Next time when your Linux will boot it will load /usr/sbin/autologin which automatically will login
Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.
Eugen Mihailescu
Latest posts by Eugen Mihailescu (see all)
- Dual monitor setup in Xfce - January 9, 2019
- Gentoo AMD Ryzen stabilizator - April 29, 2018
- Symfony Compile Error Failed opening required Proxies - January 22, 2018
Thanks.