Skip to content

Instantly share code, notes, and snippets.

@Friedjof
Last active January 21, 2024 22:36
Show Gist options
  • Save Friedjof/696122edc1030be71869ff58ac5e9361 to your computer and use it in GitHub Desktop.
Save Friedjof/696122edc1030be71869ff58ac5e9361 to your computer and use it in GitHub Desktop.

SSH key authentication for the TUM Rechnerhalle

Author: Friedjof Noweck

*write a comment if you have any questions or suggestions

Demonstration

After this guide you should be able to connect to the Rechnerhalle via SSH without a password or username like this:

ssh tum

Steps

  1. Create a SSH key pair
  2. Copy the public key to the Rechnerhalle
  3. Configure SSH

Create a SSH key pair

First you need to create a SSH key pair. This can be done with the following command:

Press enter to use all default values (you also don't need to enter a password)

ssh-keygen

Copy the public key to the Rechnerhalle

Now you need to copy the public key to the Rechnerhalle. This can be done with the following command:

ssh-copy-id <your-rbg-user>@halle.in.tum.de

or if you don't have ssh-copy-id installed:

cat ~/.ssh/id_rsa.pub | ssh <your-rbg-user>@halle.in.tum.de "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Configure SSH

Edit the SSH config file:

nano ~/.ssh/config

and add the following lines:

Host tum
    HostName halle.in.tum.de
    User <your-rbg-user>

Let's test it

Now you should be able to connect to the Rechnerhalle via SSH without a password or username like this:

ssh tum

Alternative

Alternatively you can set an alias in your .bashrc file:

alias ssh-tum="ssh <your-rbg-user>@halle.in.tum.de"

and connect to the Rechnerhalle via SSH like this:

ssh-tum

Tip – Add also the SSH key to the TUM Bitbucket server

Use the SSH link from Artemis to clone your repository in the future and you don't need to enter your password anymore. You can also use this SSH key pair to the TUM Bitbucket server. Just copy the public key to your Bitbucket account.

  1. Follow this Link
  2. Click on Add key
  3. Copy the public key to the Key field (Use cat ~/.ssh/id_rsa.pub to get the public key)
  4. Add a Label (e.g. <pc-name>)
  5. Click on Add key Now you should be able to clone your repository via SSH without a password or username like this:
git clone git@<your-repository-url>

Further information

@elias-schmid
Copy link

Very cool, I always wondered if there is a way to get rid of the annoying copy/pasting of the Artemis Git password every time I push something. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment