adam
4a4fb4158f
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
20 lines
455 B
Bash
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 |