Ste*_*itz 2 linux bitbake yocto
我喜欢为我的 yocto 项目的内置用户做一些事情:
1.) 将 root 的密码设置为“abc”
2.) 将 ssh 登录表单的 root shell 设置为 /bin/sh 为 /bin/bash
3.) 添加密码为“xyz”的用户“customUser”
认为一个简单的食谱可以做到这一点。到目前为止,我尝试过@myUser.bb:
SUMMARY = "admin + user"
SECTION = "USR"
LICENSE = "CLOSED"
inherit extrausers useradd
# how to
# pw: abc
# at bash: usermod -p $(openssl passwd abc) root
# get a salted hash: openssl passwd abc
# one possible result: 1Cw5PHLy76ps2
# the command now looks: usermod -p 1Cw5PHLy76ps2 root
# set image root password
EXTRA_USERS_PARAMS = "usermod -p 1Cw5PHLy76ps2 root;"
USERADD_PACKAGES = "${PN}"
# password
# "xyz"
# openssl passwd xyz
# result: y5UyLBO4GNAwc
USERADD_PARAM_${PN} = "-u 1200 -d /home/customUser -r -s /bin/bash -p y5UyLBO4GNAwc customUser"
do_install_append () {
install -d -m 755 ${D}${datadir}/customUser
# The new users and groups are created before the do_install
# step, so you are now free to make use of them:
chown -R customUser ${D}${datadir}/customUser
# groups
# chgrp -R group1 ${D}${datadir}/customUser
}
FILES_${PN} = "${datadir}/*"
#ALLOW_EMPTY_${PN} = "1"
Run Code Online (Sandbox Code Playgroud)
知道如何完成这项工作吗?
您可以EXTRA_USERS_PARAMS
在主配方中使用global 。
inherit extrausers
EXTRA_USERS_PARAMS = " useradd customUser1; \
useradd customUser2; \
usermod -p 'Password_1' customUser1; \
usermod -p 'Password_2' customUser2; \
usermod -a -G sudo customUser1; \
usermod -a -G sudo customUser2;"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11929 次 |
最近记录: |