Skip to content

Instantly share code, notes, and snippets.

@stereosupersonic
Last active March 30, 2021 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stereosupersonic/43367f3934b6de2354779aa1744b4fcc to your computer and use it in GitHub Desktop.
Save stereosupersonic/43367f3934b6de2354779aa1744b4fcc to your computer and use it in GitHub Desktop.
setup basic login
#!/bin/bash
# enable host for stereosonic or another user
set -e
echo "Start"
PUBKEY="" # TODO if key is not on github
id -u stereosonic > /dev/null 2>&1 || \
adduser stereosonic --disabled-password \
--gecos "" --quiet
mkdir -p /home/stereosonic/.ssh
echo "$PUBKEY" \
> /home/stereosonic/.ssh/authorized_keys
apt-get update
apt-get install -yq --no-install-recommends curl sudo openssh-server
curl https://github.com/stereosupersonic.keys >> /home/stereosonic/.ssh/authorized_keys
chown -R stereosonic /home/stereosonic/.ssh
apt-get install sudo
grep -q stereosonic /etc/sudoers || \
echo "stereosonic ALL = (ALL) \
NOPASSWD: ALL" >> /etc/sudoers
echo "FINISH"
@stereosupersonic
Copy link
Author

stereosupersonic commented Mar 30, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment