* changing ownership of a file in a package
@ 2016-07-25 12:22 piotr.lewicki
2016-07-25 13:58 ` Leonardo Sandoval
0 siblings, 1 reply; 4+ messages in thread
From: piotr.lewicki @ 2016-07-25 12:22 UTC (permalink / raw)
To: yocto
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: changing ownership of a file in a package
2016-07-25 12:22 changing ownership of a file in a package piotr.lewicki
@ 2016-07-25 13:58 ` Leonardo Sandoval
2016-07-25 14:07 ` piotr.lewicki
0 siblings, 1 reply; 4+ messages in thread
From: Leonardo Sandoval @ 2016-07-25 13:58 UTC (permalink / raw)
To: piotr.lewicki, yocto
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: changing ownership of a file in a package
2016-07-25 13:58 ` Leonardo Sandoval
@ 2016-07-25 14:07 ` piotr.lewicki
2016-07-25 14:40 ` Gary Thomas
0 siblings, 1 reply; 4+ messages in thread
From: piotr.lewicki @ 2016-07-25 14:07 UTC (permalink / raw)
To: Leonardo Sandoval, yocto
Thank you. I will try this, but I wonder what is the right way of
dealing with that when I want to change the ownership of let's say 2
files from different packages to a user that I create?
Is using "useradd" possible in 2 separate recipes (to create the same user)?
Thanks,
Piotr
On 25.07.2016 15:58, Leonardo Sandoval wrote:
> 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
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: changing ownership of a file in a package
2016-07-25 14:07 ` piotr.lewicki
@ 2016-07-25 14:40 ` Gary Thomas
0 siblings, 0 replies; 4+ messages in thread
From: Gary Thomas @ 2016-07-25 14:40 UTC (permalink / raw)
To: yocto
On 2016-07-25 16:07, piotr.lewicki wrote:
> Thank you. I will try this, but I wonder what is the right way of dealing with that when I want to change the ownership
> of let's say 2 files from different packages to a user that I create?
>
> Is using "useradd" possible in 2 separate recipes (to create the same user)?
Probably not good practice - have one create the user and the other recipe
depend on it at build time so you know it's already in place. Note that you
can set the ownership on the install command using -o and -g
> On 25.07.2016 15:58, Leonardo Sandoval wrote:
>> 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
>>>
>>
>
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-25 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25 12:22 changing ownership of a file in a package piotr.lewicki
2016-07-25 13:58 ` Leonardo Sandoval
2016-07-25 14:07 ` piotr.lewicki
2016-07-25 14:40 ` Gary Thomas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.