Created
March 24, 2020 05:04
-
-
Save oliver-batchelor/b0d488b1a33be66dfd8576169478cdb8 to your computer and use it in GitHub Desktop.
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
#!/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