在基于 Ubuntu 的系统中,从桌面环境中,可以从终端仿真器打开多个选项卡,而无需每次都登录:用户已经登录了每个选项卡(通常每个选项卡对应一个/dev/pts/x
设备)。
通过按 Ctrl+Alt+F1 ... F6 可以访问tty
全文本全屏终端。但与图形终端仿真器选项卡不同,每次执行新操作时都需要重新登录tty
。
有没有办法避免这种情况?当我从图形环境(我登录的地方!)访问那些文本终端时,我希望按下 Ctrl+Alt+F1 ... F6 时已经登录。
答案1
Ubuntu 默认使用agetty
来管理 TTY。它的手册页定义了-a, --autologin username
自动登录指定用户名的选项。因此,可以执行以下操作:
在您最喜欢的文本编辑器中打开具有 root 权限的
/etc/init/tty1.conf
文件。我正在这样做,sudo vim /etc/init/tty1.conf
但您可以使用pkexec gedit /etc/init/tty1.conf
将默认行更改
exec /sbin/getty -8 38400 tty2
为exec /sbin/getty --autologin myUserName -8 38400 tty2
。- 保存并退出。根据需要对其他 tty 文件重复上述操作
请注意,对于单用户系统来说,这是合适的,但当您有多个用户时不建议这样做(出于明显的隐私原因)
答案2
请参阅man screen
其中部分内容:
DESCRIPTION
Screen is a full-screen window manager that multiplexes a physical
terminal between several processes (typically interactive shells).
Each virtual terminal provides the functions of a DEC VT100 terminal
and, in addition, several control functions from the ISO 6429 (ECMA 48,
ANSI X3.64) and ISO 2022 standards (e.g. insert/delete line and support
for multiple character sets). There is a scrollback history buffer for
each virtual terminal and a copy-and-paste mechanism that allows moving
text regions between windows.
CTRLAltFn我经常在屏幕上使用它