Remote Editing via SSH (Windows)

1 post / 0 new
Remote Editing via SSH (Windows)

I use Windows as my primary work environment, and access my Pi over SSH. For small changes I use the VIM Editor through the remote terminal, but for more detailed work and reading large files I find it very useful to be able to edit them on my local text editor -- Sublime Text 3. I find this setup a good compromise between the steep learning curve of VIM, and not having to forward graphical interfaces over the somewhat limited bandwidth on the Pi using X11 forwarding.

The following steps are geared to get you setup using a Windows SSH client such as PuTTY, but I use Bitvise Tunnelier which has quite a bit more functionality.

  1. Install Sublime Text 3
  2. Install ST3's Package Manager plugin
  3. On Sublime Text 3, open Package Manager (Ctrl-Shift-P on Linux/Win, Cmd-Shift-P on Mac, Install Package), and search for rsub
  4. Configure your preferred SSH client to connect to the Pi.
    • For Tunnelier SSH, add the following rule under the S2C tab:
      • Listen Interface: 192.ADDR.TO.PI
      • Listen Port: 52698
      • Destination Host: localhost
      • Destination Port: 52698
    • For PuTTY, add the following rule under the Connection -> SSH tab:
      • Source Port: 52698
      • Destination: localhost:52698
      • Select the REMOTE and AUTO radio buttons.
      • Press ADD.
  5. Install rsub on your Pi by running the following code:
    • sudo wget -O /usr/local/bin/rsub
    • sudo chmod +x /usr/local/bin/rsub
  6. Ensure that Sublime Text is open first, and then use the following command to open any text file:
    • rsub <textfile.txt>
  7. Marvel at the wonders of modern technology.

One of the advantages of this method is the ability to run sudo rsub to edit and save any files that require elevated privileges.