Passer au contenu principal

SSH connection from Windows

To access the DCSR clusters from a Windows host, you have to use an SSH client.

Several options are available:

We present here only MobaXterm (since it's a great tool that also allowallows to transfer files with a GUI) and the PowerShell options. For both options, we'll see how to connect through SSH with a password and with a key.

MobaXterm

Connection with a password

After opening MobaXterm, you have to create a new session:

image-1637855599086.png

Then you have to configure the connection:

image-1637855844680.png

Then you can choose to save or not your password in MobaXterm:

image-1637855958519.png

Finally, you are connected to Curnagl:

image-1637855982735.png

You can see, on the left panel, a file browser. This represents your files on the cluster and it can be used to edit small text files, or to download/upload files to/from your laptop.

Connection with a key

First you have to create a key:

image-1637856210025.png

A new windows is opened, there you can choose the kind of key (Ed25519 is a good choice):

image-1637856320671.png

While the key generation, you have to move the mouse over the window to create entropy:

image-1637856429206.png

When the key is generated, copy the public key into a text document:

image-1637858153947.png

Then, choose a passphrase (very important to protect your private key), and save the private key in your computer:

image-1637858382625.png

Once the private key is saved, you can create a new SSH session that uses a private key:

image-1637858608767.png

The first time you will connect, you will be prompted to enter the password of your UNIL account:

image-1637858679413.png

Once connected to the cluster, put the content of you public key at the end of a file called ~/.ssh/authorized_keys. This can be done using that command:

echo "PUBLIC_KEY" >> ~/.ssh/authorized_keys

(of course replace PUBLIC_KEY in the previous command with the value of you public key pasted in a text file)

image-1637858969167.png

And the next time you will connect, you will be prompted to enter the SSH key passphrase, and not the UNIL account password:

image-1637859097534.png

SSH from PowerShell

Connection with a password

First, you have to run Windows PowerShell:

image-1637859384206.png

Once the terminal is here, you can just run the following command, add Curnagl to the list of known hosts, and enter your password (UNIL account):

ssh username@curnagl.dcsr.unil.ch

image-1637859622117.png

Connection with a key

First you have to open Windows Powershell:

image-1637860320009.png

Then you have to generate the key with the following command:

ssh-keygen -t ed25519

You can accept the default name for the key (just hit Enter), and then you have to choose a passphrase:

image-1637860426985.png

Then you have to print the content of the public key, connect on Curnagl using the password method (with UNIL password, and execute the following command:

echo "PUBLIC_KEY" >> ~/.ssh/authorized_keys

(of course replace PUBLIC_KEY in the previous command with the value of you public key pasted from the terminal)

Once this is done, you can exit the session, and connect again. This time the passphrase of the SSH key will be asked instead of your UNIL account password:

image-1637860990146.png