base-image/scripts/add_deploy_user.sh
2022-12-15 20:45:20 -06:00

13 lines
424 B
Bash

#!/usr/bin/env bash
set -eux
readonly USERNAME="deploy"
arch-chroot /mnt useradd --create-home --user-group $USERNAME
arch-chroot /mnt bash -c "echo $USERNAME:$USERNAME | chpasswd"
arch-chroot /mnt mkdir -p /etc/sudoers.d
arch-chroot /mnt touch /etc/sudoers.d/99_$USERNAME
arch-chroot /mnt chmod 0440 /etc/sudoers.d/99_$USERNAME
arch-chroot /mnt echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" > /mnt/etc/sudoers.d/99_$USERNAME