Linux: Auto Login without XDM
Beware that the following contains a severe security issue if not well used.
A tiny command in C
source code
1 2 3 4 |
int main() { execlp("login","login","-f","YOUR LOGIN HERE",0); } |
compilation
Just use gcc :
1 |
gcc -o autologin autologin.c |
Usage
First, Copy the compiled command to /usr/sbin. Then, edit you inittab file (eg. /etc/inittab) and modify to have line like the following :
1 |
1:2345:respawn:/sbin/getty -n -l /usr/sbin/autologin 38400 tty1 |
You can always log-in as a different user by using another virtual term or any ssh connection.
Extras
Now that your user is automatically logged in, you can execute any command after you have been logged using your bash profile. For exemple adding the following in you ~/bash_profile will automatically log you in if current tty is tty1:
1 2 3 |
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then startx fi |
This will automaticaly launch X when the current used tty is /dev/tty1