VPS bootstrap: unlock the deploy user and give it passwordless sudo #1
Reference in New Issue
Block a user
Delete Branch "fix/bootstrap-unlock-deploy-user"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
bootstrap-vps-ssh.shstopped on a fresh Contabo Debian 13 with:useraddleaves the new user's password field as!. Hardening setsUsePAM no, and then sshd refuses even key logins for that user (User deployer not allowed because account is locked). Root kept working because it has a password. This does not depend on the user name;deployerfails the same way.The deploy user is key-only with no password, so
sudo ./install-rubix.shandsudo ./up.shfrom the README could not work either.Fix
!to*(no password, not locked). Only an unset or locked field is changed; an existing password hash is left alone./etc/sudoers.d/90-rubix-<user>withNOPASSWD:ALL, checked withvisudo -cfbefore it is moved in place. Installsudoif the image does not have it.Test
Reproduced locally in
debian:trixie:UsePAM noplus a!user givesPermission denied (publickey). After the patched user-setup block, key login works andsudo -n id -ureturns0. Re-running the block is idempotent.Recovering an already bootstrapped server
Root key login still works: