server_init/scripts/02_remove_old_user.sh
Nelis c34d2b4849 Initial server init setup with Ansible playbook
Automated server provisioning with Pangolin reverse proxy, Forgejo git
server with SSH passthrough, and OpenCode dev environment. Includes
server hardening (UFW, fail2ban, SSH lockdown), Docker, Rust, Python/uv,
and unattended security upgrades.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 10:34:20 +00:00

8 lines
321 B
Bash
Executable file

#!/bin/bash
set -e
echo "=== Phase 2: Removing default user '$OLD_USER' ==="
ssh -t -o StrictHostKeyChecking=accept-new "$NEW_USER@pangolin.$HOST" \
"sudo pkill -u $OLD_USER 2>/dev/null || true; sleep 1; sudo deluser --remove-home $OLD_USER 2>/dev/null || sudo userdel -r $OLD_USER; echo 'Removed user: $OLD_USER'"