要通過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
的組合鍵。在每個終端上,你將看到一個登錄提示,輸入用戶名和密碼后,你將能夠登錄到系統。