Remote development in VSCode with SSHFS
Install vscode
https://code.visualstudio.com/downloadWe will be setting up ssh keys for authentication
CHOOSE ONLY ONE METHOD
If one doesn't work then try the other
In short, ssh keys let you be authenticated without having to
type the password. There are two "keys" involved, the public
and private key. Your private key MUST NEVER be exposed.
Here I will show you how to set them up to avoid password prompts.
Pick one of the two methods.
Method 1: using puTTYGEN
since the most of you are told to use putty, I will show you how
to setup password-less sessions.
1. download putty if you haven't, puTTYGEN is downloaded with it.
2. open puTTYGEN and you will see the following.
3. click on generate and follow the instructions.
4. At this point you will have the keys, you can save them wherever but I
recommend to create a folder called .ssh in your home directory.
DON'T CLOSE ANYTHING
5. save the public key as id_rsa.pub
6. save the private key as id_rsa, the ppk extension will be appended by default.
7. click on conversion and export as sshKEY and save it as id_rsa.pem
8. Now open the putty application.
9. login to your account and do the following,
run the following command, mkdir -p ~/.ssh/ && touch ~/.ssh/authorized_keys
now open up the file we made as nano ~/.ssh/authorized_keys
now take the public key(if you closed the puTTYGEN client then open it),
and then copy the whole key, make sure that you select all and copy, then
paste it to the file in nano (by right clicking), once you get the key in there
then save the file with ctrl + o and then ctrl + x.
10. Now you will create a session, first type this z*******@turing.cs.niu.edu or hopper.
then go to ssh click the plus and click on auth.
Please note that step 5, the file may be different for you,
just point it to the private key you made earlier, such as your HOME/.ssh
then click on and go to where the .ppk is.
then save.
Now if you double click, you should be in.
In sshfs, this is the configuration for the key.
This is how we use sshfs to connect and open the terminal.
Method 2(The easy one imo)
since most of you have windows 10, or Mac, you can check to see if you
have ssh installed, just type ssh -v or maybe ssh --v or ssh --version in the terminal
WIN - powershell
MAC - whatever you people have, I think iterm2?
you'll get the version of ssh if its installed.
next type ssh-keygen, when prompted just press enter on everything,
when you get to the passphrase, you can enter one but most people don't.
the keys will now be generated and they be in ~/.ssh as id_rsa.pub and id_rsa.
the rsa one without the extension on the private one while .pub is the public one.
You will now do the following when you CONNECT to turing/hopper
run the following command, mkdir -p ~/.ssh/ && touch ~/.ssh/authorized_keys
now open up the file we made as nano ~/.ssh/authorized_keys
Note that your public key will be the smaller one in size since on some machines, the .pub is ommited.
then copy the public key and paste it to authorized_keys
then copy the public key and paste it to authorized_keys
in most cases you can right click on the terminal to paste.
then save the file with ctrl + o and then ctrl + x.
you will now have the config of your sshfs point to the private keygen
at ~/.ssh
now you can connect without the password in your terminal should you wish.
Install SSH FS extension.
It should look like this.
Also note that most of the images are sized down for your viewing convenience.
click on the image as a new tab to get the full sizes.
Then click on the following.
please note that the private key will be in ~/.ssh/id_rsa.
Meaning that the .ssh folder will be in your own computer's HOME directory.
These are the only settings you need to be concerned with.
Host: whatever machine you connect to ie. turing.cs.niu.edu or hopper
Root: /home/turing/zid(z123456789)
If that doesnt work then change turing to hopper
Username : your zid(z123456789)
Password: you can leave this field blank as we set up ssh-keys
Click save. Dont touch anything else except the fields I mentioned above.
Close and open up vscode again.
Then click on the following and see if its opens succesfully.
If it doesnt work then check where your home directory is by typing
pwd on the terminal when you ssh(putty) to turing/hepper.
An extension that I recommend is bracket colorizer and doxygen.