#!/usr/bin/env bash

set -eo pipefail

useradd --user-group --create-home dice-admin

echo "dice-admin 	ALL=(ALL)	NOPASSWD: ALL" >/etc/sudoers.d/dice-admin

sudo -u dice-admin --set-home -- bash -c 'mkdir ~/.ssh && chmod 0700 ~/.ssh && echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFhaRf7eBgTiz5BEceSam6ACeUrU3lPHnl18aZL8Imar dice-admin shared key" >~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys'
