Monday, March 3, 2008

(autologin linux) autologin user, bash script




( find more Linux Administration tips )


1. create /bin/autologin.sh and make it executable
  • # chmod +x /bin/autologin.sh
...
  • #!/bin/bash
  • /bin/login -f root
...
or
...
  • #!/bin/bash
  • /bin/login -f kitkat
...


2. edit /etc/initab

from
...
  • 1:2345:respawn:/sbin/getty 38400 tty1
  • 2:23:respawn:/sbin/getty 38400 tty2
  • 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
...
to
...
  • 1:2345:respawn:/sbin/getty -n -l /bin/autologin.sh 38400 tty1
  • 2:23:respawn:/sbin/getty 38400 tty2
  • 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
...
or
...
from
...
  • 1:2345:respawn:/sbin/agetty tty1 9600
  • 2:2345:respawn:/sbin/agetty tty2 9600
  • 3:2345:respawn:/sbin/agetty tty3 9600
  • 4:2345:respawn:/sbin/agetty tty4 9600
  • 5:2345:respawn:/sbin/agetty tty5 9600
  • 6:2345:respawn:/sbin/agetty tty6 9600
...
to
...
  • 1:2345:respawn:/sbin/agetty -n -l /bin/autologin.sh tty1 9600
  • 2:2345:respawn:/sbin/agetty tty2 9600
  • 3:2345:respawn:/sbin/agetty tty3 9600
  • 4:2345:respawn:/sbin/agetty tty4 9600
  • 5:2345:respawn:/sbin/agetty tty5 9600
  • 6:2345:respawn:/sbin/agetty tty6 9600
...
or simply
...
  • respawn:/sbin/mingetty --autologin tty1
3. reboot

( find more Linux Administration tips )