在centos6中有initctl 可以启动tty等。此命令在 upstart-0.6.5-10.el6.x86_64 rpm包中
或者 mingetty 命令启动 tty
#initctl start tty TTY=/dev/tty6
在centos7已经没有此命名及相应的rpm包。
应该是通过 agetty命令启动tty, util-linux-2.23.2-26.el7.x86_64
agetty alternative Linux getty, agetty opens a tty port, prompts for a login name and invokes the /bin/login command. It is normally invoked by
init(8).
启动 #agettty tty2
centos 7 下使用systemd-getty-generator 生成更多的tty
systemd-getty-generator — Generator for enabling getty instances on the console
file: /usr/lib/systemd/system-generators/systemd-getty-generator
centos 7 下tty相关的systemd 服务
console-getty.service disabled
container-getty@.service static
getty@.service enabled
serial-getty@.service disabled
getty.target static
利用 systemctl mask 屏蔽服务
for i in {4..6}; do
systemctl mask getty@tty${i}.service
done
修改 /etc/systemd/logind.conf 文件中
#NAutoVTs=6
#ReserveVT=6
可以屏蔽屏蔽掉后面的,如设置为1 和 0. 但我们使用的是tty2. tty1无法屏蔽掉
待学习:
1. 此命令的功能;
2. 此rpm中其他命令的功能
3. 在centos7中的相应功能
4. 如何修改centos控制台上的标题
5. 修改/etc/systemd/logind.conf 中 NAutoVTs=0, ReserveVT=0 都能看到前两个tty