1. # set password and group data for user
  2. echo "<uname>:x:500:" >> ${IMAGE_ROOTFS}/etc/group
  3. echo "<uname>:<hashed-passwd>:500:500:Linux User,,,:/home/<uname>:/bin/bash" \
  4. >> ${IMAGE_ROOTFS}/etc/passwd
  5. # add home dirs for default user
  6. install -d ${IMAGE_ROOTFS}/home/<uname>
  7. cp -f ${IMAGE_ROOTFS}/etc/skel/.bashrc ${IMAGE_ROOTFS}/etc/skel/.profile \
  8. ${IMAGE_ROOTFS}/home/<uname>
  9. chown <uname>:<uname> -R ${IMAGE_ROOTFS}/home/<uname>
  10. # add <uname> group to sudoers
  11. echo "%<uname> ALL=(ALL) ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
  12. chmod 0440 ${IMAGE_ROOTFS}/etc/sudoers
  13. chmod u+s ${IMAGE_ROOTFS}/usr/bin/sudo

rootfs user hack

Comments powered by Disqus