要通过getty实现Linux系统的多用户登录,请按照以下步骤操作:
systemd
包提供的。你可以使用以下命令检查getty是否已安装:systemctl status getty@tty1
getty@.service
的文件,将其放置在/etc/systemd/system/
目录下。在这个文件中,添加以下内容:[Unit]
Description=Serial Getty on %I
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service
[Service]
ExecStart=-/sbin/agetty --noclear --keep-baud tty%I 115200,38400,9600 $TERM
Restart=always
Type=idle
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes
[Install]
WantedBy=multi-user.target
Alias=getty.target.wants/getty@%i.service
sudo systemctl enable getty@tty1
sudo systemctl enable getty@tty2
sudo systemctl enable getty@tty3
sudo systemctl enable getty@tty4
sudo systemctl enable getty@tty5
sudo systemctl enable getty@tty6
sudo systemctl start getty@tty1
sudo systemctl start getty@tty2
sudo systemctl start getty@tty3
sudo systemctl start getty@tty4
sudo systemctl start getty@tty5
sudo systemctl start getty@tty6
现在,你应该能够在不同的终端上登录到Linux系统。要切换到其他终端,请按下Ctrl + Alt + F1
到F6
的组合键。在每个终端上,你将看到一个登录提示,输入用户名和密码后,你将能够登录到系统。