LoveDuckie

Remote SSH Text Editor through Visual Studio Code

Remote SSH Text Editor through Visual Studio Code

Remote SSH Text Editor through Visual Studio Code

Remote SSH Text Editor through Visual Studio Code

Updated 3 years ago
4 Minute(s) to read
Posted 5 years ago Updated 3 years ago 4 Minute(s) to read 23 comments

In this article, I will outline what is required in order to be able to remotely modify text files from a Visual Studio Code instance running from your workstation. It has made working on a remote file system significantly simpler, especially when having to modify configuration files on a remote system.

Requirements


Configuration

The following sections will cover what is required in order to setup both your Visual Studio Code instance, as well as your running Linux instance. Ensure that you have root or administrative privileges to your running Linux instance.

Visual Studio Code

Install the Remote VSCode extension for Visual Studio Code. This extension will enable launch a run-time during the launch of Visual Studio Code which will enable for text file editing over a listening SSH tunnel.

Configuring Remote VSCode Extension

Modify your user or workspace settings (whichever you prefer), and specify the following properties. This configuration file can be found in the .vscode directory of your workspace. Alternatively, you can modify your workspace settings by using CTRL + P and searching "workspace".

User settings required for configuring Remote VSCode extension.

This property will ensure that the required run-time for opening a connection with rmate will be running and listening when Visual Studio Code launches. This local run-time will enable for you to open remote files over a SSH connection, that will be configured and setup in the next section.


Configuring Linux server over SSH

Connect to your running Linux instance over SSH, and ensure that the user account user has sudo or elevated privileges. Next, you are going to want to download the latest version of the rmate script from the GitHub repository that it resides in.

The following set of commands will download the script at head revision from the GitHub repository to the correct location on your running Linux instance, and will modify it's file permission properties so that it can be executed anywhere by any account or group on your running instance of Linux.

#!/bin/bash

# This should work on Ubuntu 18.04+

sudo wget -O /usr/local/bin/rmate https://raw.github.com/aurora/rmate/master/rmate
sudo chmod a+x /usr/local/bin/rmate

rmate should now be available to you anywhere you navigate to through the terminal, as the script has been stored under the /usr/local/bin/ directory, and has been granted permissions to execute.


Setting up PuTTY (Windows)

Ensure that you have PuTTY installed on your machine, and that you can successfully establish a SSH connection to your running Linux instance through the tool.

A screenshot of PuTTY with the remote port forwarding configuration options assigned.


Testing connectivity

Once you have successfully configured your PuTTY instance, connect to your running Linux instance and navigate to the file that you wish to have opened in Visual Studio Code. Run a separate Visual Studio Code instance, and ensure that the SSH listener is running in the background.

You should notice this little icon in your status bar for Visual Studio Code once you have successfully established a connection with the target machine over SSH.

You should notice this little icon in your status bar for Visual Studio Code once you have successfully established a connection with the target machine over SSH.


Usage

To open a remote file from your terminal into a running Visual Studio Code instance on your machine, simply run the following command.

In this example, I am opening a configuration file for NGINX.

root@your-machine-here:/etc/nginx# rmate nginx.conf

You should notice that after running this command on the remote system that the file will automatically open in your running Visual Studio Code instance. Magic!


Further Reading


Programming Languages:

Shell Script Bash


Comments

Comments


Truly quite a lot of beneficial knowledge.
<a href="https://customthesiswritingservice.com/">argumentative thesis statement</a> thesis statements <a href="https://writingthesistops.com/">college thesis</a> college thesis
<a href=https://phdthesisdissertation.com/>what is a phd</a> dissertation writer <a href=https://writeadissertation.com/>phd dissertation writing</a> buy dissertations
how to write a good analytical essay https://essaywritingservicehelp.com


Incredible a lot of beneficial advice!
<a href=https://studentessaywriting.com/>cheap research paper writing service</a> best resume writing service 2019 <a href=https://essaywritingserviceahrefs.com/>essay writing service uk</a> grad school essay writing service


You've made the point.
<a href=https://essaytyperhelp.com/>essay helper online</a> essay helper <a href=https://helptowriteanessay.com/>medical school personal statement</a> paperhelp


Amazing plenty of good advice!
<a href=https://studentessaywriting.com/>mba essay writing service</a> best paper writing service <a href=https://essaywritingserviceahrefs.com/>college essay writing</a> linkedin writing service


Cheers! Numerous postings.
<a href="https://essayssolution.com/">essay writier</a> pro essay writer <a href="https://cheapessaywriteronlineservices.com/">essay writing for hire</a> birdie essay writer


Kudos. I appreciate this!
<a href="https://studentessaywriting.com/">best online essay writing services reviews</a> essay writing service reddit <a href="https://essaywritingserviceahrefs.com/">custom paper writing service</a> online paper writing service
<a href=https://argumentativethesis.com/>thesis in an essay</a> bachelor thesis writing service <a href=https://bestmasterthesiswritingservice.com/>customer service thesis pdf</a> master thesis writing service
writing an opinion essay https://bestonlinepaperwritingservices.com


Thanks! Quite a lot of advice.
<a href="https://domyhomeworkformecheap.com/">cpm homework</a> coursework website <a href="https://domycollegehomeworkforme.com/">can i pay someone to do my homework</a> coursework website
<a href=https://service-essay.com/>pay for paper</a> custom research papers for sale <a href=https://custompaperwritingservices.com/>writing services for college papers</a> best paper writing services reviews
homework help writing https://studentessaywriting.com


Thanks a lot, I like this.
<a href="https://topswritingservices.com/">professional essay writing</a> online check writing service <a href="https://essaywriting4you.com/">i need help writing an essay</a> essay writing company
<a href=https://essaypromaster.com/>writing my paper for me</a> how to write a scientific paper <a href=https://paperwritingservicecheap.com/>write my term paper</a> essay writers
how to write good argumentative essays https://theessayswriters.com


Thanks a lot, Plenty of material!
<a href="https://argumentativethesis.com/">thesis literature review</a> engineering thesis writing service <a href="https://bestmasterthesiswritingservice.com/">thesis correction service</a> thesis writing service


Effectively voiced without a doubt. .
<a href="https://essayssolution.com/">essay writer review</a> write my essay discount code <a href="https://cheapessaywriteronlineservices.com/">college admission essay writer</a> write a essay