[yocto] changing ownership of a file in a package

Leonardo Sandoval leonardo.sandoval.gonzalez at linux.intel.com
Mon Jul 25 06:58:58 PDT 2016


As a workaround, have you tried using the other class to include users 
(useradd)? Look at the 'note' of this section

http://www.yoctoproject.org/docs/2.1/ref-manual/ref-manual.html#ref-classes-extrausers

Leo


El 07/25/2016 a las 07:22 AM, piotr.lewicki escribió:
> Hi,
>
> I have a package where I want to install some files into a home 
> directory of a user "testuser". I create a user in my image bb file 
> using "extrausers".
>
> My problem is that I'm unable to change ownership of those files from 
> root to the testuser.
>
> Simple "chown testuser:testuser -R /home/testuser" inside do_install 
> task makes those files being owned by "nobody".
>
> How can I manage ownership of those files properly?
>
>
>
> The recipe is like so:
>
> DESCRIPTION = "Files installed in testuser user home directory"
> LICENSE = "CLOSED"
>
> SRC_URI += " \
>            file://authorized_keys \
>            file://bash_profile \
>            file://bashrc \
>            "
>
> do_install(){
>     install -d ${D}/home/testuser/
>     install -m 0644 ${WORKDIR}/bash_profile 
> ${D}/home/testuser/.bash_profile
>     install -m 0644 ${WORKDIR}/bashrc ${D}/home/testuser/.bashrc
>
>     install -d ${D}/home/testuser/.ssh
>     install -m 0644 ${WORKDIR}/authorized_keys ${D}/home/testuser/.ssh/
> }
>
> FILES_${PN} = "/home/testuser"
>
>
> Thanks,
>
> Piotr
>




More information about the yocto mailing list