This is testing number 2

5 min read
This is testing number 2

This is testing number 3.

Step 1: Install Remote-SSH Extension in VS Code

Launch VS Code -> click Extension icon in the left bar -> search Remote-SSH in search box -> install it:

Then you will see a little remote connection icon shown in the bottom-left of the Status Bar:

Step 2: Verify SSH Connection in PowerShell

Click the top left Terminal or the shortcut ctrl+shift+` to open a PowerShell terminal in VS Code -> if it’s not PowerShell, change it from here:

Verify SSH connection by executing ssh [email protected] in PowerShell. (It doesn’t matter if you run this in a conda env or not)

If you can successfully login to the remote server, you are ready for the next step.

💢 If you get the Corrupted MAC on input error as below:

You can try the following solution:

Run ssh -Q mac first. It will return a list of all available MAC cryptographic algorithms on your local system:

Then, choose one of them as you like and connect to the remote server again by adding the selected algorithm with -m option:

ssh -m hmac-md5-96 [email protected]

You many need to try several times until you find the algorithm which is supported by your remote Linux server.

Now, you should be able login to the remote server and ready for the next step.

Step 3: Enable the Remote Connection in VS Code

Click the left-bottom remote connection icon -> select Remote-SSH: Open Configuration File…

or you can directly open the ssh configuration file from your local home directory ~/.ssh/config .

Add your remote server information in configuration file in below format:

Host [hostname]
 HostName [hostname]
 User [username]
 MACs [optional; if you have the MAC error in Step 2, add the available algorithm which you found to here]

In case you have multiple servers to connect, just keep the format and append them one by one.

At the end, you will get a config file like below: (We will come back to the IdentityFile in the next step)

This example maintains three different remote servers

Now, you should be able to connect to the remote server without MAC error.

Click the remote connection icon in the bottom-left -> select Remote-SSH: Connect to Host… -> you will see a list of remote servers maintained in your config file -> click your target server (you may need to enter your login password)

A list of maintained hosts

After the successful connection, you will be navigated to a new VS Code window and the remote host name is shown in the bottom-left:

Until here, you have successfully setup a workable remote development workspace via VS Code. But, not finish yet.

If you stop here, you will be asked to enter the login password every time when you issue a remote connection. And you also need to enter the password for the each single operation on that remote server via VS Code even just open a folder. This would be really annoying. On the other hand, password logins is not secure enough. It’s easy to use and understand for everyone, but this convenience somehow sacrifices the security level. Password can be easily broken by the brute-force attack.

Therefore, instead of entering password in VS Code, it’s better to use SSH public and private key pairs to do the authentication.

Step 4: Generate SSH Key Pairs

In VS Code Powershell terminal, execute the command:


During the key generation, it will prompt:

This allows you define a location to store the keys. Press ENTER to leave it as default.

This allows you enter and double confirm a password to protect your private key (when you type, it won’t display your password). After this, you need to enter this password when you use the private key in future. This is an extra protection. You can press ENTER to skip it.

After the creation, you will see a key’s random art image. And your key pairs are stored in the default hidden ~/.sshdirectories:

To double check, you can review he key pairs in above location via:

cd ~/.ssh

You will see two new files id_rsa which stores the private key and which stores the public key. Run cat [filename]to check the key content.

If everything is fine. Now, you can add the path of the private key ~/.ssh/id_rsain the ssh configuration file as Step 2 with name of IdentityFile:

Just keep in mind, one public key can be used multiple times and ❗ do NOT share your private key to anyone.

Step 5: Copy the Public Key to the Remote Server

Login to the remote server via VS Code or any other terminal with password. Check if you have the authorized_keys file under~/.ssh directory. If not, create one by following commands:

cd ~/.ssh  
touch authorized_keys

authorized_keys is the default file name defined by OpenSSH used to store the public keys. You can maintain multiple public keys in this file. Make sure that each key is on a single line and no line-breaks in the middle of the key.

Then maintain your public key (the content in your local ~/.ssh/ file) in this remote file:

vim authorized_keys -> press i to shift to INSERT mode -> paste your public key content here -> press ESC + : + wq to write into and quit the file -> recheck it by cat authorized_keys .

Now, your secure and convenient remote development workspace in VS Code is ready!


Just go back to your VS Code. Issue a new remote connection. Now, you should be able to connect to the remote server without the password and work on it just as you are locally. Have fun!