This article is the second in a series about sublime text and how to set it up for remote development using the SFTP package. I suggest you refer to our previous article about the installation and configuration of sublime text 3.

Most of our development and deployment work will be happening in the remote server or cloud servers. In that case, we can use the sublime SFTP package to work with remote servers where we can push (Local to remote) or pull (Remote to Local) the codes/files using file transfer protocol. SFTP comes with a license cost but we can install the package and use it for an indefinite time.

Features of Sublime Text sFTP
  • FTP, SFTP, and FTPS protocols are supported.
  • Can either use password or SSH key-based authentication.
  • Sync folders – Locally, Remotely, and Bi-directionally.
  • Possible to sync only recently made changes.
  • The difference in local vs. remote versions of a file.
  • Persistent connections for good performance.

Installing sFTP on Sublime Text Editor

Assuming that you have installed and configured package control as described in the articleCOMMAND PALLET [ CTRL + SHIFT + P ] → INSTALL PACKAGE → SFTP.

Install sFTP in Sublime Text

Install sFTP in Sublime Text

Now open COMMAND PALLET [ CTRL + SHIFT + P ] → Type SFTP. You will find several options to work with SFTP functionalities. We will explore all of these options over the course of this article.

Sublime Text sFTP Options

Sublime Text sFTP Options

I have a directory where it contains two python scripts which will be Synced to a remote machine. My remote machine is Linux Mint 19.3 running on a VM. Now let’s configure the remote setup. Right-click on the project folder → SFTP/FTP → Map to Remote.

Configure Remote Setup for sFTP

Configure Remote Setup for sFTP

The sftp-config.json file will be created in the project folder which holds the remote configuration settings.

Remote Configuration Settings

Remote Configuration Settings

Let’s break down the settings and configure some important parameters. There are three different protocols (SFTP, FTP, and FTPS) can be used. Here we will use “SFTP”.

sFTP Protocol

sFTP Protocol

We will now configure remote host information like hostname, username, and port. Password will be prompted when we start the sync. The hostname can be FQDN or IP address and by default port number is 22.

Remote Host Settings

Remote Host Settings

SSH key-based authentication is also possible, we can create a Public-Private key pair and the key can be pointed to the location using the parameter “ssh_Key_file”.

SSH Authentication

SSH Authentication

Configure the remote directory path “remote_path” where the project files and folders need to be synced. We can also set file and directory permission using “file_permission” and “dir_permission” parameters. We can ignore files and folders to be synced by providing the file identifier in “ignore_regexes”.

Configure Remote Path

Configure Remote Path

We have done some mandatory configuration in sftp-config.json to start syncing our files to the remote machine. We have a few more options to configure depending upon the need. But as of now, these are the important parameters that we need to get going. Now in my remote machine, my directory /home/tecmint is empty. We will upload the project folder to /home/tecmint now.

Project Home Directory

Project Home Directory

Right-click on project folder → SFTP/FTP.

sFTP Operations

#development tools #editors #linux ide #open source #sublime code editor #linux

How to Setup Sublime Text sFTP for Remote Development
1.55 GEEK