https://docs.microsoft.com/en-gb/azure/virtual-machines/linux/ssh-from-windows
When we are creating our compute on AzureML, we want to enable SSH access, just incase we need it. Note: These instructions are for Mac/Linux users only (+Windows users using subsystem for linux.
What we are going to do here is use the cd "change directory" command to open up the folder that stores the ssh key on our computer.
Make a note of the ~
character here, this is an old unix convention, on very early computers used at Berkeley a.k.a BSD (specifically the Lear-Siegler ADM-3A computer) there was a key labelled HOME in the very top right corner of the keyboard, which was also used if you wanted type ~
. That keyboard design inspired the convention that ~
would mean "home" on UNIX based systems.
What is home? Home is your home directory, such as /Users/yourname/
In other words ~/.ssh
corresponds to the directory (depending on your system), for example on a mac /Users/yourusername/.ssh
cd ~/.ssh
Here we are creating a 4096 bit RSA public-private encryption key pair in the pem format. Essentially when Microsoft wants to talk to you, it will use your public key as a 'seed' to encrypt the traffic it is sending you. With the private key you have generated earlier, it is trivial to decrypt the traffic azure is sending you. Otherwise, without this private key one would have to crack the 4096bit RSA encryption, which might take a while..!
It is however theorectically possible to do it within a reasonable amount of time using shors prime factoring algorithm on a quantum computer, but we don't yet have one powerful enough!
ssh-keygen -m PEM -t rsa -b 4096
Note: Remember to give it a meaningful name
Now we want to copy that public key to our clipboard so that we can paste it into the AzureML dashboard.
What we will use is the pbcopy
function in our terminal.
The pbcopy
command will need some text input, so that it can perform its function.
You might recognise the terms stdin
and stdout
, in plain terms they refer to standard-in and standard-out.
In a programming langauge, you might want to print some text to your terminal such as "Hello World!"
In order to do this, we must interface with a real life computer, but luckily we have a programming language with a built in module, such as the println() function, so we need not worry! We can simply pass text into this function. The rest of the complexity is abstracted from us. No need to learn bytecode. Woo!
So.. in other words, stdin is a functionality that allows us to pass inputs and outputs from out terminal commands using the pipe function |
I'll show you what I mean
We are going to use cat
to copy the contents of the file, then we are going to "pipe" the output of that command into the pbcopy
command.
Like so.. we will generate data from the first command, and pass it into the second command, here pbcopy
cat <the-name-you-gave-the-ssh-key>.pub | pbcopy
Now we have copied the contents of that file (our public SSH key) to our clipboard :grin:
When we want to connect to our AzureML compute, we need to provide the SSH key in order to decrypt the traffic. What we will do with ssh-add
is load that file up so it is ready when we try to connect to our AzureML instance.
ssh-add ~/.ssh/nameofyoursshkey
Copy the SSH command found in the azure portal as per the below image, NOTE not actually the one in the below image, but the one from this page in your own azure portal
pip install -U scikit-learn
exit