Skip to content

Instantly share code, notes, and snippets.

@martinkennelly
Created October 14, 2023 11:13
Show Gist options
  • Save martinkennelly/6e05502b68bec40bd8970b02eb5278de to your computer and use it in GitHub Desktop.
Save martinkennelly/6e05502b68bec40bd8970b02eb5278de to your computer and use it in GitHub Desktop.
setup non-root user with passwordless root
# Setup user group and user and ensure passwordless root
groupadd mk && useradd --gid mk --groups mk,users,adm --shell /bin/bash -c "mk home" --create-home mk
cat <<EOT >> /etc/sudoers.d/99-mk
mk ALL=(ALL) NOPASSWD:ALL
EOT
# Create new .ssh dir in mk home dir and add a public key to authorized_key file and set perms
chmod 400 authorized_key
chown -R mk:mk ~mk/.ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment