[yocto] changing ownership of a file in a package

piotr.lewicki piotr.lewicki at elfin.de
Mon Jul 25 05:22:50 PDT 2016


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