From 8780a57a1e4ad73446ae6f762262e85e7d157494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Rivera?= Date: Thu, 23 Jul 2026 22:45:20 +0200 Subject: [PATCH] fix file path and perm --- bootstrap.sh | 54 +++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 295be48..63a692c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -50,6 +50,28 @@ apt install -y \ unzip \ vim +################################################################################ +# User +################################################################################ + +step "Creating administrator" + +read -rp "Username: " USERNAME + +adduser "$USERNAME" + +usermod -aG sudo,docker "$USERNAME" + +mkdir -p "/home/$USERNAME/.ssh" + +cp /root/.ssh/authorized_keys \ + "/home/$USERNAME/.ssh/authorized_keys" + +chown -R "$USERNAME:$USERNAME" "/home/$USERNAME/.ssh" + +chmod 700 "/home/$USERNAME/.ssh" +chmod 600 "/home/$USERNAME/.ssh/authorized_keys" + ################################################################################ # Repository ################################################################################ @@ -57,9 +79,10 @@ apt install -y \ step "Cloning configuration repository" if [ ! -d "$REPO_DIR" ]; then - git clone "$REPO" + git clone "$REPO" /home/$USERNAME/$REPO_DIR fi -cd "$REPO_DIR" +cd "/HOME/$USERNAME/$REPO_DIR" +chown -R "$USERNAME:$USERNAME" "/home/$USERNAME/" ################################################################################ # Docker @@ -118,28 +141,6 @@ systemctl enable --now fail2ban dpkg-reconfigure unattended-upgrades -################################################################################ -# User -################################################################################ - -step "Creating administrator" - -read -rp "Username: " USERNAME - -adduser "$USERNAME" - -usermod -aG sudo,docker "$USERNAME" - -mkdir -p "/home/$USERNAME/.ssh" - -cp /root/.ssh/authorized_keys \ - "/home/$USERNAME/.ssh/authorized_keys" - -chown -R "$USERNAME:$USERNAME" "/home/$USERNAME/.ssh" - -chmod 700 "/home/$USERNAME/.ssh" -chmod 600 "/home/$USERNAME/.ssh/authorized_keys" - ################################################################################ # Storage ################################################################################ @@ -168,8 +169,8 @@ sleep 1 echo ".." sleep 1 echo "..." - -mountpoint /mnt/kdrive || {echo "kDrive is still not mounted. Waiting..." && sleep 5 && mountpoint /mnt/kdrive } # if it fails we wait another 5 sec before retrying +sleep 1 +mountpoint /mnt/kdrive ls /mnt/kdrive ################################################################################ @@ -194,3 +195,4 @@ echo "You can now login as:" echo echo " ssh $USERNAME@" echo +echo "Deploy by running the deploy.sh script"