Sublime Forum

Locally edit remote directories/files via ssh tunneling

#1

As the title suggests I want to edit on my local machine ( Machine A ) files that are in a server ( Machine C ) that is accessible after sshing to another server ( Machine B ) (two hops in total).

I’m using Sublime Text 4 with the SFTP plugin, but I don’t think it has the option of tunneling. I’m using Windows on the local computer (with WSL2 Ubuntu installed) and the remote server has Ubuntu.

I can use WinSCP to edit individual files in Sublime but I’m interested in accessing entire directories. I’ve tried using the WInSCP plugin but it doesn’t to work.

What would be the best way to achieve that?

0 Likes

#2

I have tried two approaches both of which are lacking.

Approach 1: Install rmate on remote server ( Machine C ) and rsub on the local computer ( Machine A ). I followed the instructions here and here. Sadly, this only enables me to edit individual files exactly like WinSCP.

Approach 2: Using sshfs. This way I mount the directory I want from the remote server ( Machine C ) to my local computer ( Machine A ). I used the following command.

sshfs username@MachineC:/path/to/remote/dir /path/to/local/dir -o ssh_command='ssh -J username@MachineB'

The problem with this approach lies with Sublime as it does not play well with mounted directories. It doesn’t refresh when the files are changed and it needs a restart to register the changes.

Any other suggestion would be appreciated.

0 Likes

#3

That’s what we have.

ST heavily relies on filesystem notifications to update its internal representation of all folders and files. Hence it’s not playing well with filesystems, such as sshfs or the WSL2 which don’t support those.

There’s also no API for plugins such as sftp or rsub to built their own filesystem tries. The only thing a plugin can do is receiving a list of files and present them in a quick panel.

ST isn’t designed for remote workflows.

0 Likes

Can you manage repository on remote server via ssh?