Disable root login in yocto build

落花浮王杯 提交于 2020-08-23 12:00:51

问题


I am new in yocto project and I simply want to disable root login in yocto build image? I do not want my final image to ask me for login. Simply I need to flash my yocto image on sdcard and no login prompt shows.

Any help is appreciated.


回答1:


If you are using systemd, in the file meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service change the ExecStart in the service to this :

ExecStart=-/sbin/agetty -a USERNAME -8 -L %I @BAUDRATE@ $TERM

change USERNAME to root or other.




回答2:


iF YOU ARE USING SYSTEM V Add below lines in build/conf/local.conf file.

EXTRA_IMAGE_FEATURES = "debug-tweaks "
IMAGE_INSTALL_append = " mingetty "  

Now the below recipe provide the serial inittab open file and look at the do_install function

poky/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb

./poky/meta/recipes-core/sysvinit/sysvinit-inittab/inittab

#1:2345:respawn:/sbin/getty 38400 tty1 #comment this line in bb file

1:2345:respawn:/sbin/mingetty --autologin root tty1 # add this line




回答3:


When you create your image, add debug-tweaks to EXTRA_IMAGE_FEATURES, this will allow no password to root. and add mingetty.

EXTRA_IMAGE_FEATURES = "debug-tweaks "
IMAGE_INSTALL_append = " mingetty "

After that, edit /etc/inittab, comment out the previous line and use mingetty for autologin;

#1:2345:respawn:/sbin/getty 38400 tty1
1:2345:respawn:/sbin/mingetty --autologin root tty1


来源:https://stackoverflow.com/questions/43780096/disable-root-login-in-yocto-build

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!