Skip to content

Instantly share code, notes, and snippets.

@dloman
Last active August 5, 2022 21:27
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 dloman/a892fdac0150c87d2f6aa095c835a722 to your computer and use it in GitHub Desktop.
Save dloman/a892fdac0150c87d2f6aa095c835a722 to your computer and use it in GitHub Desktop.
sshpiper add
#!/usr/bin/bash
if [ $1="-h" ]; then
echo "USAGE: sshpiperadd.bash \$NAME \$USERNAME \$IP "
exit
fi
if [ "$#" -ne 4 ]; then
echo "USAGE: sshpiperadd.bash \$NAME \$USERNAME \$IP "
exit
fi
NAME=$1
USERNAME=$2
IP=$3
sudo sshpiperd pipe add -n $NAME -u $IP --upstream-username $USERNAME
sudo ln -s /home/sbhx/.ssh/authorized_keys /var/sshpiper/$NAME/authorized_keys
sudo ssh-keygen -N '' -f /var/sshpiper/$NAME/id_rsa
sudo ssh-copy-id -i /var/sshpiper/$NAME/id_rsa.pub $USERNAME@$IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment