I’m using Yocto Kirkstone. To modify users on my embedded linux target device I use extrausers class along with EXTRA_USERS_PARAMS
variable. At first I used it for changing root password.
So in my custom-image.bb
file, in which I define my image, I was using:
inherit extrausers
#Change root password
PASSWD = "$5$2BF1ipFTZnZ0Kkp5$O30hqNFAhq8GDIZb23XH7/JC3Z20sGiwrA1rSH3jzk9"
EXTRA_USERS_PARAMS = "
usermod -p '${PASSWD}' root;
"
And that worked.
In the next step, I was trying to change another user configuration. It was www-data
user, which is apache2 user on my target system. From apache2_%.bbappend
file:
#----Modify user for apache2 - www-data user-----
inherit extrausers
EXTRA_USERS_PARAMS += "
usermod -d /home/www-data/ www-data;
"
do_install:append(){
install -d ${D}/home/www-data
}
FILES:${PN} += "/home/www-data"
I also changed the assign operator in my custom-image.bb
file from =
to +=
, so that both assignments to EXTRA_USERS_PARAMS
were using +=
.
But it didn’t work, the home directory of www-data
user was installed, but the user configuration was not applied (usermod -d /home/www-data/ www-data;
did not apply)
Why I can’t use EXTRA_USERS_PARAMS
from multiple files?
When I tried moving usermod -d /home/www-data/ www-data;
to custom-image.bb
, so to the same place where the root password is being changed, then it worked. My intention of configuring the www-data
user from apache2 append file was to keep things clean and organized.
2