Skip to content

Instantly share code, notes, and snippets.

@vadimii
Last active August 29, 2015 14:16
Show Gist options
  • Save vadimii/a4c4189147a809220300 to your computer and use it in GitHub Desktop.
Save vadimii/a4c4189147a809220300 to your computer and use it in GitHub Desktop.
GitHub user to linux
#!/usr/bin/env bash
set -e
username=$1 # github username
useradd $username
usermod -aG wheel $username
sudo -u $username /usr/local/bin/ghkeys.sh
#!/usr/bin/env bash
set -e
mkdir -p $HOME/.ssh
chmod 700 $HOME/.ssh
curl -s https://api.github.com/users/$USER/keys | \
jq -r '.[].key' > $HOME/.ssh/authorized_keys
chmod 600 $HOME/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment