SSH
Simple SSH setup in VScode with Mac OS
Following tutorial: link
- Install Remote - SSH extension in VScode extensions
A blue status bar will appear at the bottom left corner - Create the remote virtual machine (VM)
Important: keep the username during creating the VM
Important: add SSH public key to the VM- keep the passphrase when generating the SSH key, which is required for SSH connection
- keep the passphrase when generating the SSH key, which is required for SSH connection
- Specify the public IP address of VM
- Establish the SSH connection
- Option 1: test the connection in command line
Bash 1 2
ssh username@hostpublichIP # example: ssh xinlei@172.190.229.141
- Option 2: establish the SSH connection in VScode
- Click the remote status bar at the bottom left corner to bring up the common remote - SSH commands
- Select the
connect to HOST
- Follow the instruction, input the
username@hostpublichIP
, and passphrase to establish the SSH connection - The remote status bar at the bottom left corner will indicate the host public IP if connection succeed
- Option 1: test the connection in command line
- Open the folder of VM in local VScode
- input
>file:Open Folder
in VScode command palette
Port forwarding
Following tutorial: link
Goal: To be able to access a port on the remote machine that may not be publicly exposed, you need to establish a connection or a tunnel between a port on your local machine and the server.
- Select
Forward a Port
from the Command Palette or select theForward a Port
button in the Ports view. You can see the Ports view in the bottom panel. - Input the port number that needed to be forwarded
- A local address will appear right to the specified port number