[yocto] Setting Default User Accounts

Chris Tapp opensource at keylevel.com
Wed Aug 20 13:19:56 PDT 2014


Hi Nick,

On 20 Aug 2014, at 20:13, Crast, Nicholas <Nicholas.Crast at saabsensis.com> wrote:

> All,
>  
> I am currently in the middle of a battle with yocto, trying to accomplish the following:
>  
> 1.)    Disable root user account
> 2.)    Create default user account with default password
>  
> I currently have the following a recipe:
> USERADD_PACKAGES = "${PN}"
> USERADD_PARAM_${PN} = "-d /home/nick -r -s /bin/bash nick "
>  
> In order to try to add a user account. I have this in my image recipe:
>  
> ROOTFS_POSTPROCESS_COMMAND += "set_nick_passwd;"
> set_nick_passwd() {
>    sed 's%^ nick:[^:]*:% nick:adySxRKMiPvjA:%' \
>        < ${IMAGE_ROOTFS}/etc/shadow \
>        > ${IMAGE_ROOTFS}/etc/shadow.new;
>    mv ${IMAGE_ROOTFS}/etc/shadow.new ${IMAGE_ROOTFS}/etc/shadow ;
> }
>  
> This is to edit the /etc/shadow file and insert a new (hashed) password. What I’m looking for is a cleaner way to do this. When I run bitbake I get a lot of warnings because the “nick” account is already an account on my build machine. This seems like a fairly common use case, and I think I am likely going about it wrong.
>  
> Does anybody have any advice?

I've not tried it for a new user, but I use a .bbappend to base-passwd to set a root password. Basically:

do_install_append() {
    sed -i 's/root::/root:<new-hash>:/' $(D)${datadir}/base-passwd/passwd.master
}

>  
> -Nick
> ----------------------------------------
> Nick Crast
> Associate Software Engineer
> Saab Sensis Corporation
> Phone: 315-445-5703
> Email: Nicholas.Crast at saabsensis.com
>  
> 
> This message is intended only for the addressee and may contain information that is company confidential or privileged. Any technical data in this message may be exported only in accordance with the U.S. International Traffic in Arms Regulations (22 CFR Parts 120-130) or the Export Administration Regulations (15 CFR Parts 730-774). Unauthorized use is strictly prohibited and may be unlawful. If you are not the intended recipient, or the person responsible for delivering to the intended recipient, you should not read, copy, disclose or otherwise use this message. If you have received this email in error, please delete it, and advise the sender immediately. -- 
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto

--

Chris Tapp
opensource at keylevel.com
www.keylevel.com




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20140820/38e19419/attachment.html>


More information about the yocto mailing list