The second part of this week’s 2-Bullet Tuesday! See the first part here. You can subscribe to the newsletter on the 2-Bullet Tuesday page!

Omega Tip

Atom & SFTP: Editing files on the Omega using a Desktop Code Editor

While we love the Editor on the Console for quick coding and text editing on the Omega, we prefer desktop editors for more involved projects. So this week, we’ll show you how to use the Atom Editor to wirelessly access and edit the files on your Omega using the SFTP protocol!

First off, we’ll need to setup the Omega to accept incoming SFTP connection requests. To start, edit /etc/opkg/distfeeds.conf, and find the line below:

## src/gz reboot_packages http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages

Remove the two # signs and the whitespace at the beginning so it looks like this:

src/gz reboot_packages http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages

Now ensure your Omega is connected to your WiFi network, then connect to the command line and run the following commands:

opkg update
opkg install openssh-sftp-server

 

Back on your computer, install the Atom text editor from their site if you don’t already have it. Atom is built by the team at GitHub and is actually the editor of choice for the Onion dev team since it’s super extendable, customizable, and hackable.

We’ll need to install the Remote-FTP package in Atom in order to connect to the Omega with SFTP. Hit the Install a Package button from the Welcome Screen, search for Remote-FTP, and install it. You can also do this by clicking on Edit -> Install:

To upload a project’s code files to your Omega, Remote-FTP needs a configuration file. You’ll need to make sure your project folder is open in Atom: go to the File menu and select Open or Add Project Folder, then select your project folder.

When you return to the main editor, open the Remote-FTP sidebar: Packages menu -> Remote-FTP -> Toggle. Hit the Edit Configuration button in the sidebar and a blank text file named .ftpconfig will be created:

Populate the config file with the following:

{
    "protocol": "sftp",
    "host": "Omega-xxxx.local",
    "port": 22,
    "user": "root",
    "pass": "onioneer",
    "remote": "/"
}

Replace the xxxx in Omega-xxxx.local with the digits of your Omega, and, if you’ve changed your Omega’s password, change the pass parameter. Save the file and then hit Connect in the Remote-FTP sidebar:

You should now be connected to the Omega, the Omega’s filesystem will be displayed in the Remote-FTP sidebar:

Open files from your Omega, read or edit them, and all changes will be saved on the Omega. With this method, you can use a familiar desktop development environment to code directly on your Omega!

For more details on Atom or the Remote-FTP package, check out their respective sites.

Happy hacking!

 

Thanks for reading & have a great week!

Let us know what kind of stuff you would like to see featured on 2-Bullet Tuesday! Send a tweet to @OnionIoT with your suggestions!

 

P.S. Get free shipping on all Onion Store orders over $75 that include a Dock, Expansion, or a Kit!