Search code examples
linuxrootyoctoopenembedded

Enable root password verification while login with serial console in Yocto


I'm trying to enable login verification for root user.

With adding below lines into local.conf, I can see password requested while login as root with SSH.

IMAGE_FEATURES_remove = "debug-tweaks empty-root-password"
EXTRA_IMAGE_FEATURES_remove = "debug-tweaks empty-root-password"

However, if I tried to login as root with Serial Console (ttyS0), it just successfully logged in without any password verification or requests.

Does anyone know how to enable login verification for serial console's access?

P.S

I didn't set any default password for root, so that it should never allow login for root user. And even if I set password for root, it still doesn't need password's input while login via serial console.


Solution

  • And even if I set password for root, it still doesn't need password's input while login via serial console.

    Are you sure it is set correctly? This is what I use to modify root user password (in a .bb file, or .inc file):

    inherit extrausers
    EXTRA_USERS_PARAMS += "usermod -P mypassword root;"
    

    If you don't want login at all, maybe you can change the shell of the user:

    inherit extrausers
    EXTRA_USERS_PARAMS += "usermod -s /bin/nologin root;"
    

    The user will exist, will be used by applciations, but will the login will not be possible.