CentOS6关闭多余tty

vi /etc/init/start-ttys.conf
#
# 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-2]
env X_TTY=/dev/tty1
task
script
    . /etc/sysconfig/init
    for tty in $(echo $ACTIVE_CONSOLES) ; do
        [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue
        initctl start tty TTY=$tty
    done
end script

找到 tty [1-6] 改成 tty [1-2]

vi /etc/sysconfig/init

ACTIVE_CONSOLES=/dev/tty[1-6] 修改为: ACTIVE_CONSOLES=/dev/tty[1-2]

重启服务器生效

注:不重启关闭多余的tty

for i in 3 4 5 6; do initctl stop tty TTY=/dev/tty$i ;done

原创文章,作者:cy,如若转载,请注明出处:https://www.cygzs.net/