Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Creating user accounts in rootfs
@ 2009-11-19 12:54 Julien Boibessot
  2009-12-10 14:38 ` Peter Korsgaard
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Boibessot @ 2009-11-19 12:54 UTC (permalink / raw)
  To: buildroot

Hi,

Does someone know a better way than the following to create user
accounts ? :
* on the target use "adduser xxx"
* then copy target's "/etc/passwd" and "/etc/shadow" to Host's
"buildroot/target/..../rootfs/target_skeleton/..."
* rebuild rootfs

My goal is to have a rootfs with preset user accounts, ready to be used
as soon as the rootfs image has been flashed.

Thanks
Julien

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

* [Buildroot] Creating user accounts in rootfs
  2009-11-19 12:54 [Buildroot] Creating user accounts in rootfs Julien Boibessot
@ 2009-12-10 14:38 ` Peter Korsgaard
  2009-12-10 15:48   ` Stephan Raue
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Korsgaard @ 2009-12-10 14:38 UTC (permalink / raw)
  To: buildroot

>>>>> "Julien" == Julien Boibessot <julien.boibessot@free.fr> writes:

Hi,

 Julien> Does someone know a better way than the following to create user
 Julien> accounts ? :
 Julien> * on the target use "adduser xxx"
 Julien> * then copy target's "/etc/passwd" and "/etc/shadow" to Host's
 Julien> "buildroot/target/..../rootfs/target_skeleton/..."
 Julien> * rebuild rootfs

 Julien> My goal is to have a rootfs with preset user accounts, ready to
 Julien> be used as soon as the rootfs image has been flashed.

No, that's certainly the easiest solution (and how I normally do it).

-- 
Bye, Peter Korsgaard

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

* [Buildroot] Creating user accounts in rootfs
  2009-12-10 14:38 ` Peter Korsgaard
@ 2009-12-10 15:48   ` Stephan Raue
  0 siblings, 0 replies; 3+ messages in thread
From: Stephan Raue @ 2009-12-10 15:48 UTC (permalink / raw)
  To: buildroot

Zitat von Peter Korsgaard <jacmet@uclibc.org>:

>>>>>> "Julien" == Julien Boibessot <julien.boibessot@free.fr> writes:
>
> Hi,
>
>  Julien> Does someone know a better way than the following to create user
>  Julien> accounts ? :
>  Julien> * on the target use "adduser xxx"
>  Julien> * then copy target's "/etc/passwd" and "/etc/shadow" to Host's
>  Julien> "buildroot/target/..../rootfs/target_skeleton/..."
>  Julien> * rebuild rootfs
>
>  Julien> My goal is to have a rootfs with preset user accounts, ready to
>  Julien> be used as soon as the rootfs image has been flashed.
>
> No, that's certainly the easiest solution (and how I normally do it).
>
> --
> Bye, Peter Korsgaard
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
>

i use an different way (but not with buildroot):

i have 2 functions:

add_user() {
   # Usage: add_user "username" "password" "userid" "groupid"  
"description" "home" "shell"
   mkdir -p ${INSTALL}/etc
   touch ${INSTALL}/etc/passwd
   if [ -z "`grep "$1:" ${INSTALL}/etc/passwd`" ]; then
     echo "$1:$2:$3:$4:$5:$6:$7" >> ${INSTALL}/etc/passwd
   fi
}

add_group() {
   # Usage: add_group "groupname" "groupid"
   mkdir -p ${INSTALL}/etc
   touch ${INSTALL}/etc/group
   if [ -z "`grep "$1:" ${INSTALL}/etc/group`" ]; then
     echo "$1:x:$2:" >> ${INSTALL}/etc/group
   fi
}

that can be called from the buildsripts (like your makefiles) with for  
example:

add_user haldaemon x 68 68 "HAL daemon" "/" "/bin/sh"
add_group haldaemon 68

for the password i dont use /etc/shadow (but you can do this also).
i install an second busybox for my host in in my toolchain dir with  
only CONFIG_CRYPTPW=y is set so i have busyboxs cryptpw utility on my  
host

  i have set an variable ROOT_PASSWORD with my rootpassword

and to set my root password i call the function add_user like:

ROOT_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw $ROOT_PASSWORD`"
add_user root "$ROOT_PWD" 0 0 "Root User" "/storage" "/bin/sh"
add_group root 0

stephan


-- 
               ### OpenELEC.tv ###
The free and open Mediacenter Distribution 4 you
               http://www.openelec.tv

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

end of thread, other threads:[~2009-12-10 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-19 12:54 [Buildroot] Creating user accounts in rootfs Julien Boibessot
2009-12-10 14:38 ` Peter Korsgaard
2009-12-10 15:48   ` Stephan Raue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox