Commit 8c2a5d14 authored by Kristian Klausen's avatar Kristian Klausen 🎉
Browse files

Don't create a user in the cloud-image

cloud-init handles it + most of the "user and groups"-module options is
ignored if the user already exist.

[1] https://cloudinit.readthedocs.io/en/latest/topics/modules.html#users-and-groups
parent 2562d089
......@@ -3,17 +3,6 @@
set -e
set -x
# setting the user credentials
useradd -m -U "${NEWUSER}"
echo -e "${NEWUSER}\n${NEWUSER}" | passwd "${NEWUSER}"
# setting sudo for the user
cat <<EOF >"/etc/sudoers.d/${NEWUSER}"
Defaults:${NEWUSER} !requiretty
${NEWUSER} ALL=(ALL) NOPASSWD: ALL
EOF
chmod 440 "/etc/sudoers.d/${NEWUSER}"
# Setup pacman-init.service for clean pacman keyring initialization
cat <<EOF >/etc/systemd/system/pacman-init.service
[Unit]
......
......@@ -3,6 +3,17 @@
NEWUSER="vagrant"
post() {
# setting the user credentials
useradd -m -U "${NEWUSER}"
echo -e "${NEWUSER}\n${NEWUSER}" | passwd "${NEWUSER}"
# setting sudo for the user
cat <<EOF >"/etc/sudoers.d/${NEWUSER}"
Defaults:${NEWUSER} !requiretty
${NEWUSER} ALL=(ALL) NOPASSWD: ALL
EOF
chmod 440 "/etc/sudoers.d/${NEWUSER}"
# setup network
cat <<EOF >/etc/systemd/network/eth0.network
[Match]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment