deployment/scripts/serviceaccount.sh
adam 4a4fb4158f
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
new plan. forget end-document, doesn't cooperate.
2024-12-06 17:06:04 -05:00

20 lines
455 B
Bash

#!/bin/bash
USERNAMETOADD=
PASSWORDTOADD=
PUBKEYCONTENT=
SUDOER_PSW=
function restofscript(){
useradd -m -s /bin/bash ${USERNAMETOADD}
echo "${USERNAMETOADD}:${PASSWORDTOADD}" | chpasswd
loginctl enable-linger ${USERNAMETOADD}
cd ~/home/${USERNAMETOADD}
mkdir .ssh
pushd .ssh
echo ${PUBKEYCONTENT} > authorized_keys
popd
chown -R "${USERNAMETOADD}:${USERNAMETOADD}' .ssh
}
echo "${SUDOER_PSW}" | sudo -S restofscript