All of lore.kernel.org
 help / color / mirror / Atom feed
* Setting Default User Accounts
@ 2014-08-20 19:13 Crast, Nicholas
  2014-08-20 20:19 ` Chris Tapp
  2014-08-21 10:21 ` ChenQi
  0 siblings, 2 replies; 4+ messages in thread
From: Crast, Nicholas @ 2014-08-20 19:13 UTC (permalink / raw)
  To: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 1920 bytes --]

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?

-Nick
----------------------------------------
Nick Crast
Associate Software Engineer
Saab Sensis Corporation
Phone: 315-445-5703
Email: Nicholas.Crast@saabsensis.com<mailto:Nicholas.Crast@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.

[-- Attachment #2: Type: text/html, Size: 5957 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Setting Default User Accounts
  2014-08-20 19:13 Setting Default User Accounts Crast, Nicholas
@ 2014-08-20 20:19 ` Chris Tapp
  2014-08-21 10:21 ` ChenQi
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Tapp @ 2014-08-20 20:19 UTC (permalink / raw)
  To: Crast, Nicholas; +Cc: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 2497 bytes --]

Hi Nick,

On 20 Aug 2014, at 20:13, Crast, Nicholas <Nicholas.Crast@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@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@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto

--

Chris Tapp
opensource@keylevel.com
www.keylevel.com





[-- Attachment #2: Type: text/html, Size: 9246 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Setting Default User Accounts
  2014-08-20 19:13 Setting Default User Accounts Crast, Nicholas
  2014-08-20 20:19 ` Chris Tapp
@ 2014-08-21 10:21 ` ChenQi
  2014-08-21 12:32   ` Akash Bhatnagar
  1 sibling, 1 reply; 4+ messages in thread
From: ChenQi @ 2014-08-21 10:21 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 2299 bytes --]

How about add in local.conf:

INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "usermod -L root; \
                       useradd -P 'test' test;"

//Chen Qi

On 08/21/2014 03:13 AM, Crast, Nicholas 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?
>
> -Nick
>
> ----------------------------------------
>
> Nick Crast
>
> Associate Software Engineer
>
> Saab Sensis Corporation
>
> Phone: 315-445-5703
>
> Email: Nicholas.Crast@saabsensis.com 
> <mailto:Nicholas.Crast@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. /
>
>


[-- Attachment #2: Type: text/html, Size: 6909 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Setting Default User Accounts
  2014-08-21 10:21 ` ChenQi
@ 2014-08-21 12:32   ` Akash Bhatnagar
  0 siblings, 0 replies; 4+ messages in thread
From: Akash Bhatnagar @ 2014-08-21 12:32 UTC (permalink / raw)
  Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 3087 bytes --]

Hi I have added new user in following way:-

S = "${WORKDIR}"

inherit useradd

USERADD_PACKAGES = "${PN}"

USERADD_PARAM_${PN} = "-u 1200 -d /home/test -r -s /bin/bash -P 'test123'
test "


GROUPADD_PARAM_${PN} = "-g 880 testgrp"


do_install () {
        install -d -m 755 ${D}/home/test

        install -p -m 644 <ANYFILE> ${D}/home/test/

        chown -R cli ${D}/home/test

        chgrp -R cligrp ${D}/home/test
}

FILES_${PN} = "/home/test/* "

INHIBIT_PACKAGE_DEBUG_SPLIT = "1"





On Thu, Aug 21, 2014 at 3:51 PM, ChenQi <Qi.Chen@windriver.com> wrote:

>  How about add in local.conf:
>
> INHERIT += "extrausers"
> EXTRA_USERS_PARAMS = "usermod -L root; \
>                       useradd -P 'test' test;"
>
> //Chen Qi
>
>
> On 08/21/2014 03:13 AM, Crast, Nicholas 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?
>
>
>
> -Nick
>
> ----------------------------------------
>
> Nick Crast
>
> Associate Software Engineer
>
> Saab Sensis Corporation
>
> Phone: 315-445-5703
>
> Email: Nicholas.Crast@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@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>
>

[-- Attachment #2: Type: text/html, Size: 6058 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-21 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 19:13 Setting Default User Accounts Crast, Nicholas
2014-08-20 20:19 ` Chris Tapp
2014-08-21 10:21 ` ChenQi
2014-08-21 12:32   ` Akash Bhatnagar

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.