more debugging junk
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
This commit is contained in:
parent
69a74f1855
commit
440638a162
@ -5,14 +5,23 @@ SUDOER_PSW=
|
||||
function restofscript(){
|
||||
USERNAMETOADD=
|
||||
PASSWORDTOADD=
|
||||
echo "hello, $(whoami)"
|
||||
useradd -m -s /bin/bash ${USERNAMETOADD}
|
||||
echo "user added"
|
||||
echo "${USERNAMETOADD}:${PASSWORDTOADD}" | chpasswd
|
||||
echo "password updated"
|
||||
loginctl enable-linger ${USERNAMETOADD}
|
||||
echo "linger enabled"
|
||||
mkdir /home/${USERNAMETOADD}/.ssh
|
||||
echo "user has .ssh/"
|
||||
touch /home/${USERNAMETOADD}/authorized_keys
|
||||
echo "user has .ssh/authorized keys"
|
||||
cat ssh.pub >> /home/${USERNAMETOADD}/.ssh/authorized_keys
|
||||
echo "authorized keys should accept ssh.pub"
|
||||
chmod 600 /home/${USERNAMETOADD}/authorized_keys
|
||||
echo "authorized keys should be mode 600"
|
||||
chown -R "${USERNAMETOADD}:${USERNAMETOADD}" /home/${USERNAMETOADD}/.ssh
|
||||
echo "correct user should own his .ssh directory. done!"
|
||||
}
|
||||
|
||||
echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript"
|
||||
|
Loading…
Reference in New Issue
Block a user