From f8c2005ba11cbdeed49c61440a420505e39f43dc Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 21 Jan 2017 11:44:47 +0100 Subject: [PATCH] Started managing users/groups --- clone/clone | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/clone/clone b/clone/clone index e77204c..a5092aa 100755 --- a/clone/clone +++ b/clone/clone @@ -83,10 +83,39 @@ echo "<<< done"; echo "\n>>> [6] Updating users & groups"; echo " (.) Adding user satsuser"; -sudo echo "satsuser:{somedigestedpass}:17185:0:999999:7::" >> /mnt/etc/shadow; -sudo echo "satsuser:{somedigestedpass}:17185:0:999999:7::" >> /mnt/etc/shadow-; +# shadow +echo " /etc/shadow"; +echo "satsuser:{somedigestedpass}:17185:0:999999:7::" | sudo tee -a /mnt/etc/shadow > /dev/mull; +echo "satsuser:{somedigestedpass}:17185:0:999999:7::" | sudo tee -a /mnt/etc/shadow- > /dev/null; + +# passwd +echo " /etc/passwd"; +echo "satsuser:x:666:666:sats-user,,,:/home/sats-user:/bin/sh" | sudo tee -a /mnt/etc/passwd > /dev/null; +echo "satsuser:x:666:666:sats-user,,,:/home/sats-user:/bin/sh" | sudo tee -a /mnt/etc/passwd- > /dev/null; + +echo " (.) Removing pi's login password"; +# create temp file without pi's password +sudo cat /mnt/etc/shadow | sed 's/pi:[^:]\+:/pi:*:/' | sudo tee /mnt/etc/shadow.tmp > /dev/null; +# write original files +sudo cat /mnt/etc/shadow.tmp | sudo tee /mnt/etc/shadow > /dev/null; +sudo cat /mnt/etc/shadow.tmp | sudo tee /mnt/etc/shadow- > /dev/null; +# remove temporary file +sudo rm /mnt/etc/shadow.tmp; + echo " (.) Adding group ssh-key"; +# group +echo " /etc/group"; +echo "ssh-key:x:555:pi,sats-user" | sudo tee -a /mnt/etc/group > /dev/null; +echo "ssh-key:x:555:pi,sats-user" | sudo tee -a /mnt/etc/group- > /dev/null; + +echo " (.) Adding group sats-user"; +# group +echo " /etc/group"; +echo "sats-user:x:666:sats-user" | sudo tee -a /mnt/etc/group > /dev/null; +echo "sats-user:x:666:sats-user" | sudo tee -a /mnt/etc/group- > /dev/null; + +