引导时如何以root用户身份自动登录到TTY?


14

我正在使用RT-PREEMPT补丁创建实时内核。我创建了没有图形桌面的内核。它在终端模式下出现,并带有登录提示。要求是,它应该引导并以root权限直接进入shell提示,而不要求登录。如何才能做到这一点?你能帮助我吗?

Answers:


16

来源:http : //linux.koolsolutions.com/2009/04/30/autologin-linux-console-mode

我已经开始使用它了,但是在Ubuntu上却略有不同。

  1. 首次安装mingetty

    sudo apt-get install mingetty
    
  2. 编辑/etc/init/tty1.conf

    更改:

    exec /sbin/getty -8 38400 tty1
    

    至:

    exec /sbin/mingetty --autologin root --noclear tty1
    
  3. 重新启动并测试。

这在Ubuntu 12.04上对我有用,如果对您有用,并且您需要更多tty来自动登录,则开始更改tty2.conf-tty6.conf,您应该会做得很好。


正如我们所说,在VM中进行测试。
Jochen Oonincx 2012年

2
你会想要的exec
geirha

D'oooh 你是绝对正确的。我将编辑:P
Jochen Oonincx 2012年

也为ubuntu-server 14.04工作。
harshitgupta 2014年

1
/sbin/getty似乎支持--auto-loginUbuntu 14.04.02以来的论点
VarunAgw 2015年

1

您无需任何其他软件即可执行此操作

sudo vim /etc/inittab

注释掉

1:2345:respawn:/sbin/getty 115200 tty1

并替换为

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

所以你剩下这个

#1:2345:respawn:/sbin/getty 115200 tty1
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

与“ 1:2345:respawn:/ sbin / getty --noclear --autologin root 38400 tty1”有何不同?
Orphans
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.