adam
a98147901c
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
23 lines
549 B
Bash
23 lines
549 B
Bash
#!/bin/bash
|
|
|
|
SUDOER_PSW=
|
|
|
|
function restofscript(){
|
|
USERNAMETOADD=
|
|
PASSWORDTOADD=
|
|
PUBKEYCONTENT=
|
|
useradd -m -s /bin/bash ${USERNAMETOADD}
|
|
echo "${USERNAMETOADD}:${PASSWORDTOADD}" | chpasswd
|
|
loginctl enable-linger ${USERNAMETOADD}
|
|
cd ~/home/${USERNAMETOADD}
|
|
mkdir .ssh
|
|
pushd .ssh
|
|
pwd
|
|
echo ${PUBKEYCONTENT} >> authorized_keys
|
|
chmod 600 authorized_keys
|
|
popd
|
|
chown -R "${USERNAMETOADD}:${USERNAMETOADD}" .ssh
|
|
}
|
|
|
|
echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript"
|
|
exit |