Keywords: Sublime Text 3 | SSH | remote file editing
Abstract: This article provides a comprehensive guide on how to edit remote files in Sublime Text 3 using SSH and packages like rsub or RemoteSubl. It covers server-side installation, local configuration, SSH tunneling, and file operations, with updated recommendations for current practices.
Introduction
With the increasing need for remote development, editing files on a server from a local editor has become essential. Sublime Text 3, a popular text editor, can be extended to support remote file editing via SSH. This article details a method based on the rsub package or its modern alternative RemoteSubl, allowing seamless file operations.
Server-Side Configuration
First, install a remote editor package on the server. The rsub script can be downloaded and made executable. For example, use wget to fetch it from the repository and set permissions.
wget -O /usr/local/bin/rsub https://raw.github.com/aurora/rmate/master/rmate
chmod a+x /usr/local/bin/rsubAlternatively, for updated systems, consider using RemoteSubl, which is available via package managers.
Local Configuration
On the local machine, install the corresponding Sublime Text package. In Sublime Text 3, open the Package Manager (Ctrl-Shift-P on Windows/Linux, Cmd-Shift-P on Mac), search for "rsub" or "RemoteSubl", and install it.
SSH Tunneling Setup
Establish a connection to the remote server using SSH with a reverse tunnel. This forwards the local port 52698 to the server, enabling communication.
ssh -R 52698:localhost:52698 username@server_addressFile Operations
After connecting, navigate to the file on the server and use the rsub command to open it in Sublime Text 3. The file will automatically appear in the editor.
rsub /path/to/file.txtRecommendations and Considerations
As of recent updates, the RemoteSubl package is recommended over rsub due to better integration with Sublime Text's package control. Ensure that firewall settings allow the port 52698, and verify that both server and local configurations are correct.