Set default root password

From KoanSoftware Wiki
Jump to: navigation, search

Set default root password

Define a regular password for the root user when using Yocto Project

For example, create a new image or add to your image's bbappends

ex: core-image-minimal.bbappend

inherit extrausers
ROOTPASSWORD = "123456789"
ROOTUSERNAME = "root"
EXTRA_USERS_PARAMS = "usermod -P ${ROOTPASSWORD} ${ROOTUSERNAME};"

or

inherit extrausers
ROOTPASSWORD = "123456789"
ROOTUSERNAME = "root"
pkg_postinst_${PN} () {
  #!/bin/sh -e
  # Note: Destination directory is available during boot
  #
  process and unset at first boot
  if [ -z $D ]; then
    usermod -p ${ROOTPASSWORD} ${ROOTUSERNAME};
  fi
}