@@ -26,10 +26,34 @@ git clone --branch "${GIT_BRANCH}" "https://${GIT_PROVIDER}/${GIT_REPO}" "${CLON
2626echo " cd $CLONE_DIR " >> " /home/${ACTUAL_USER} /.zshrc"
2727
2828# --- 2. Set Permissions ---
29+
30+ # Function to fix ownership and permissions for a directory
31+ fix_dir_permissions () {
32+ local dir_path=$1
33+ echo " Fixing permissions for ${dir_path} ..."
34+ chown -R ${ACTUAL_USER} :${ACTUAL_USER} " ${dir_path} "
35+ find " ${dir_path} " -type d -exec chmod 700 {} +
36+ find " ${dir_path} " -type f -exec chmod 600 {} +
37+ }
38+
39+ # Function to fix ownership for a file
40+ fix_file_owner () {
41+ local file_path=$1
42+ echo " Fixing ownership for ${file_path} ..."
43+ chown ${ACTUAL_USER} :${ACTUAL_USER} " ${file_path} "
44+ }
45+
2946echo " Setting permissions for user '${ACTUAL_USER} ' on '${CLONE_DIR} '..."
3047# Give the user ownership of the newly cloned repository folder
3148chown -R ${ACTUAL_USER} :${ACTUAL_USER} " ${CLONE_DIR} "
3249
50+ # Fix permissions for mounted directories and files
51+ fix_dir_permissions " /home/${ACTUAL_USER} /.ssh"
52+ fix_dir_permissions " /home/${ACTUAL_USER} /.gnupg"
53+ fix_dir_permissions " /home/${ACTUAL_USER} /.gemini"
54+ fix_dir_permissions " /home/${ACTUAL_USER} /shared_srv"
55+ fix_file_owner " /home/${ACTUAL_USER} /.gitconfig"
56+
3357# --- 3. Set User Password ---
3458# Check if the ACTUAL_PASSWORD environment variable is provided
3559if [ -n " $ACTUAL_PASSWORD " ]; then
@@ -39,8 +63,9 @@ if [ -n "$ACTUAL_PASSWORD" ]; then
3963 echo " Password has been set."
4064else
4165 # Warn the user if the password is not set
42- echo " WARNING : No 'ACTUAL_PASSWORD' environment variable found."
66+ echo " ERROR : No 'ACTUAL_PASSWORD' environment variable found."
4367 echo " User '${ACTUAL_USER} ' will not have a password set, and password-based SSH may fail."
68+ exit 1
4469fi
4570
4671# --- 4. Start SSH Server ---
0 commit comments