Atom: Using remote-atom in Windows 10

Today we will go through installing the hackable text editor Atom on Windows 10. Then we’ll install and configure the remote-atom package, which will allow us to edit files stored on a remote Ubuntu server. For these steps I’m using Ubuntu 16 on VirtualBox (remote), all running on a Windows 10 host (local), as described in this previous article.

remote-atom uses rmate and SSH port forward to transfer files. Note that rmate does not support opening an entire directory, which is a feature lots of people find useful in Atom. In this scenario, a package like remote-sync may be more useful, which I’ve also written about here.

1. Install Atom on Windows (local)

If you haven’t already done so, download Atom from https://atom.io/ and run the executable to complete the installation.

2. Install remote-atom package (local)

We can use the remote-atom package to connect to the Ubuntu server via SSH. Read more about remote-atom here: https://atom.io/packages/remote-atom

  • Open Atom and select File > Settings > Install

  • In the Search Packages text box, type remote-atom and hit enter. Then click Install from the search results.

3. Install rmate and ssh in Ubuntu (remote)

  • In Ubuntu, we need to install rmate

    sudo curl -o /usr/local/bin/rmate https://raw.githubusercontent.com/aurora/rmate/master/rmate
    sudo chmod +x /usr/local/bin/rmate
    sudo mv /usr/local/bin/rmate /usr/local/bin/ratom
    

We also need to install ssh, but first we’ll configure VirtualBox to allow the connection. I referenced these steps from http://stackoverflow.com/a/10532299

  • Now install ssh

    sudo apt-get install openssh-server
    

4. Start remote-atom in Windows (local)

  • Launch Atom and from the top menu select Packages > Remote Atom > Start Server

5. Install and configure putty in Windows (local)

  1. Download and install PuTTY for Windows: http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

  2. Open PuTTy and add a new tunnel. These steps are references from http://stackoverflow.com/a/24513399

    • In the left navigation expand Connection > SSH
    • Select Tunnels
    • In the section Add new forwarded port, enter Source port as 52698
    • In Destination type localhost:52698
    • Select Remote and Auto
    • Click Add

    PuTTY Tunnel

  3. Now open PuTTY and ssh to 127.0.0.1 port 3022 and login using your Ubuntu user account

  4. cd into the truffle project directory

  5. Finally, we open the file in Atom. Make sure that Atom is running, and enter the following in PuTTY:

    ratom [filename.txt]
    

    This should cause the file to open in Atom. On save of the file, it should automatically sync back to Ubuntu. This is great for editing individual files when interacting with an Ubuntu server from Windows. For editing multiple files or projects, something like remote-sync may be better suited.