Skip to content

Instantly share code, notes, and snippets.

@oliver-batchelor
Created March 24, 2020 05:04
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 oliver-batchelor/b0d488b1a33be66dfd8576169478cdb8 to your computer and use it in GitHub Desktop.
Save oliver-batchelor/b0d488b1a33be66dfd8576169478cdb8 to your computer and use it in GitHub Desktop.
#!/bin/bash
read -p 'Enter COSC Username: ' user
echo "Writing ~/.ssh.config..."
cat > ~/.ssh/config << END
# This is the most part as it allows access to the gateway computer
# Accessing any internal computers requires this base configuration.
Host cosc
Hostname linux.cosc.canterbury.ac.nz
# Change this to YOUR username
User $user
IdentityFile ~/.ssh/cosc_rsa
Host cs*
ProxyJump cosc
# Change this to YOUR username
User $user
StrictHostKeyChecking=no
# This allows common settings for ALL hosts
Host *
ServerAliveInterval 240
StrictHostKeyChecking=no
ForwardX11 Yes
IdentityFile ~/.ssh/cosc_rsa
END
chmod 600 ~/.ssh/config
ssh-keygen -o -t rsa -f ~/.ssh/cosc_rsa -q -P ""
ssh-copy-id -i ~/.ssh/cosc_rsa "$user"@linux.cosc.canterbury.ac.nz
scp ~/.ssh/cosc_rsa.* cosc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment