aboutsummaryrefslogtreecommitdiff
path: root/util/mkrootfs
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-06 10:46:39 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-06 10:46:39 +0100
commitae327cc50fd9d3e59e9f60088243adfc69cb312e (patch)
tree4efe5520ba87a604cf35e3d5c00d196e214bf1ae /util/mkrootfs
parentb854e8abb7e1ff0b43c9f99e9b641895e4d6c148 (diff)
fix busybox booting into root shellweek3
Diffstat (limited to 'util/mkrootfs')
-rwxr-xr-xutil/mkrootfs17
1 files changed, 7 insertions, 10 deletions
diff --git a/util/mkrootfs b/util/mkrootfs
index 5818fdb..91eff68 100755
--- a/util/mkrootfs
+++ b/util/mkrootfs
@@ -28,13 +28,10 @@ cp $CPFLAGS "$OVERLAY_FS/." .
# setuid busybox
chmod a=xrs,u+w bin/busybox
-# # create /etc/passwd
-# if ! [ -e etc/passwd ] ; then
-# # TODO: add root to a group
-# echo "root:x:0:0::/root:/bin/sh" > etc/passwd
-# fi
-# # and /etc/shadow
-# if ! [ -e etc/shadow ] ; then
-# echo "root:$(mkpasswd alpine):::::::" > etc/shadow
-# fi
-#
+# create a root user
+! [ -e etc/passwd ] && echo "root:x:0:0::/root:/bin/sh" > etc/passwd
+! [ -e etc/shadow ] && echo "root:!:0:0:99999:0:::" > etc/shadow
+! [ -e etc/group ] && echo "root:x:0:root" > etc/shadow
+
+# exit safely (continue makefile)
+exit 0