Skip to content

Instantly share code, notes, and snippets.

@m1tk4
Last active January 10, 2019 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m1tk4/e5b88fa0e246c87f1eb22a2f54a3375f to your computer and use it in GitHub Desktop.
Save m1tk4/e5b88fa0e246c87f1eb22a2f54a3375f to your computer and use it in GitHub Desktop.
Creating a TTY on Centos6 with Automatic Login

Automatic Login TTY on Centos 6

  1. Copy /etc/init/tty.conf to /etc/init/tty-autologin.conf and edit the new file as follows ("myuser" is the user we want to end up logged in automatically on TTY1):
# tty - getty
#
# This service maintains a getty on the specified device.
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file tty.override and put your changes there.

stop on runlevel [S016]

respawn
instance $TTY
exec /sbin/mingetty --autologin myuser $TTY
# ADD THIS:         ^^^^^^^^^^^^^^^^^^^
usage 'tty TTY=/dev/ttyX  - where X is console id'
  1. Copy /etc/init/start_ttys.conf to /etc/init/start_ttys.override and edit the .override file as follows:
#
# This service starts the configured number of gettys.
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file start-ttys.override and put your changes there.

start on stopped rc RUNLEVEL=[2345]

env ACTIVE_CONSOLES=/dev/tty[1-6]
env X_TTY=/dev/tty1
task
script
        . /etc/sysconfig/init
        for tty in $(echo $ACTIVE_CONSOLES) ; do
                [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue
                t = `basename "$tty"`
                case $num in
                       tty1) initctl start tty-autologin.conf TTY=$tty ;;
                       *) initctl start tty TTY=$tty
                esac
        done
end script
@zlatin
Copy link

zlatin commented May 3, 2018

Thanks. It helped me a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment