Skip to content

Setting up SSH key authentification

Setting up the SSH key autenthification allows you to securely connect to the controller node and to running Docker containers. Using this, you can access running jobs with VS Code or Pycharm to debug your code more efficiently. To set up an ssh-key configuration, launch a terminal on your local machine and type the following command:

ssh-keygen

Follow the instructions, it will generate a public (with a .pub extension) and a private key on your computer, the location of which is displayed when going through the keygen command. Copy the contents of the public key with the following command and make sure to remember the created paraphrase. You can show your public key with the following command.

cat ~/.ssh/id_rsa.pub

Then, login to oaks-lab controller node using your username and password.
Upload the public key to the remote server by following these 3 steps:

1. create a directory (if it doesn't exist already) named .ssh in your home directory on the controller node (you can check whether it exists with ls -a)

cd ~/
mkdir -p .ssh

2. in that directory, create a file named authorized_keys (if it doesn't exist already)

cd .ssh
touch authorized_keys

3. copy (or append) the contents of your public key (located at ~/.ssh/id_rsa.pub on your local machine) into the remote ~/.ssh/authorized_keys file. You can use the nano text editor with the following command. Next, exit the file with ctrl+x.

nano authorized_keys

From then on, you should be able to login to the controller node without having to type your password each time.

NB: never share your private key! The only one that is safe to share / copy is your public key (which always ends up with a .pub)