Started managing users/groups

This commit is contained in:
xdrm-brackets 2017-01-21 11:44:47 +01:00
parent 7cc407dad3
commit f8c2005ba1
1 changed files with 31 additions and 2 deletions

View File

@ -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;