First, we need to make sure that your account has ssh keys generated
Generate SSH Keys
Right click the Start Menu icon and open a NON-Admin Terminal, PowerShell, or Command Prompt depending on your version of windows.
Skip if you know this has already been done once or risk overwritting your existing keys
Type in ssh-keygen.exe
and hit enter until it stops asking questions.
Open Keys
Paste in the command notepad ~/.ssh/id_rsa.pub
into the command prompt and hit Tab and then enter.
If you do not hit tab, this will not work!
Notepad will open with your SSH Key, copy it to your clipboard and close the window.
Enter this key into the Authorized Keys file of the required servers relative account or give to your Server Admin to enter. This is not covered in this guide.
Plugins
Make sure to install the RemoteSSH plugin from Microsoft
Connnect
Once installed, click the icon in the bottom left
At the top of Code pops up an input window. Select Connect to Host
And then select Add New SSH Host
Enter in your information in the following format replacing root with your username and xxx.xxx.xxx.xxx with the external IP of the server you are connecting to.
ssh root@70.98.99.14 -A
ssh root@70.98.99.14 -p 222 -A
If you need to specify a port, use the following format instead replacing 2222 with the port you were given.
Press Enter to confirm and enter again on the top option.
You should see this pop up in the bottom left.
Depending on the system you are in, when you first try to connect, a vscode-server will be set up and configured on your server.
In linux that can be in /Home/<user>/.vscode-server
If you are on windows, check what that is.
The first solution is to try the extension command: Remote-SSH: kill VS Code Server on Host
Open the command pallet (CTRL + SHIFT + P
or COMMAND + SHIFT + P
(mac) ).
And type Remote kill
:
Then try to connect again! (That will kill the server on the host! Which will make it start again on the next try)