From a98147901cfe323bf322669e2aa32fd4e21a64ba Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 6 Dec 2024 18:20:35 -0500 Subject: [PATCH] ok maybe tho --- scripts/1clickservice.groovy | 2 +- scripts/serviceaccount.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/1clickservice.groovy b/scripts/1clickservice.groovy index 3778d2e..8bb7b48 100644 --- a/scripts/1clickservice.groovy +++ b/scripts/1clickservice.groovy @@ -222,7 +222,7 @@ pipeline { curl -u '${env.GITEA_USR}:${env.GITEATOKEN}' https://gitea.arg.rip/greyn/deployment/raw/branch/service/scripts/serviceaccount.sh --output serviceaccount.sh sed -i 's/USERNAMETOADD=/USERNAMETOADD="${servicename}"/' serviceaccount.sh sed -i 's/PASSWORDTOADD=/PASSWORDTOADD="${env.pw_linuxserviceaccount}"/' serviceaccount.sh - sed -i 's/PUBKEYCONTENT=/PUBKEYCONTENT="\$(cat ${servicename}-ssh.pub)"/' serviceaccount.sh + sed -i "s/PUBKEYCONTENT=/PUBKEYCONTENT=\"\$(cat ${servicename}-ssh.pub)"/\" serviceaccount.sh sed -i 's/SUDOER_PSW=/SUDOER_PSW="${SUDOER_PSW}"/' serviceaccount.sh echo "serviceaccount :)" diff --git a/scripts/serviceaccount.sh b/scripts/serviceaccount.sh index 34c29a7..1fe9b51 100644 --- a/scripts/serviceaccount.sh +++ b/scripts/serviceaccount.sh @@ -12,10 +12,11 @@ function restofscript(){ cd ~/home/${USERNAMETOADD} mkdir .ssh pushd .ssh - echo ${PUBKEYCONTENT} > authorized_keys + pwd + echo ${PUBKEYCONTENT} >> authorized_keys chmod 600 authorized_keys popd - chown -R '${USERNAMETOADD}:${USERNAMETOADD}' .ssh + chown -R "${USERNAMETOADD}:${USERNAMETOADD}" .ssh } echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript"