Last active
August 29, 2015 14:06
-
-
Save msanders/9ffa66f0847cb005be91 to your computer and use it in GitHub Desktop.
Pair session setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# From http://collectiveidea.com/blog/archives/2014/02/18/a-simple-pair-programming-setup-with-ssh-and-tmux/ | |
set -eu | |
HELP=false | |
for flag in "$@"; do | |
case "$flag" in | |
-h|--help) HELP=true;; | |
esac | |
done | |
if [ $# -eq 0 -o $HELP = true ]; then | |
echo "usage: $(basename "$0") gh-username" | |
exit 1 | |
fi | |
# Create an account alias | |
sudo dscl . -append "/Users/$USER" RecordName Pair pair | |
# Configure sshd to only allow public-key authentication | |
sudo sed -E -i.bak 's/^#?(PasswordAuthentication|ChallengeResponseAuthentication).*$/\1 no/' /etc/sshd_config | |
# Add pair user public keys | |
touch ~/.ssh/authorized_keys | |
gh-auth add --users "$1" --command="$( which tmux ) attach -t pair" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment