I am connecting to remote server using "mRemoteNG" and want to open remote server files in my local sublime text editor. During my research, I found this relevant blog https://wrgms.com/editing-files-remotely-via-ssh-on-sublimetext-3/ and followed the instructions but it is not working for me. Does, anybody know how can I open remote files in my Sublime?
-
I found the answer in this http://stackoverflow.com/questions/15958056/how-to-use-sublime-over-ssh I implemented the tenth answer (winscp part) of this question.. – Raman Balyan May 27 '16 at 07:08
4 Answers
On server
Install rsub:
wget -O /usr/local/bin/rsub \https://raw.github.com/aurora/rmate/master/rmate
chmod a+x /usr/local/bin/rsub
On local
- Install rsub Sublime3 package:
On Sublime Text 3, open Package Manager (Ctrl-Shift-P on Linux/Win, Cmd-Shift-P on Mac, Install Package), and search for rsub and install it
- Open command line and connect to remote server:
ssh -R 52698:localhost:52698 server_user@server_address
- after connect to server run this command on server:
rsub path_to_file/file.txt
- File opening auto in Sublime 3
As of today (2018/09/05) you should use : https://github.com/randy3k/RemoteSubl because you can find it in packagecontrol.io while "rsub" is not present.

- 5,230
- 4
- 34
- 59

- 2,792
- 1
- 19
- 17
-
1on local,you can use git client to ssh the remote server.the git client ships with ssh client.https://git-scm.com/download/win – sixsixsix Jun 30 '17 at 07:29
-
-
30Managed to get this working, but this is only good for opening individual files? Is there a way to do something like subl * to open up all directories and files for a project in Sublime? – ugotchi Sep 13 '17 at 11:27
-
1My [blog article](https://random.ac/cess/2017/07/03/workflow-magic-or-so-it-seems/) about `rsub/rmate` includes details/links for setting up `rsub/rmate` on both macOS and Windows. – Ville Nov 07 '17 at 07:39
-
3after doing the last step, on ST3, the file does not open automagically. Is there something I am missing here ? – qre0ct Nov 27 '17 at 11:45
-
8What error you get? `connect_to localhost port 52698: failed.`? If so, you should open "Sublime Text" first then execute step 3. – igauravsehrawat Jan 04 '18 at 16:05
-
1@h.emamie I get "No command 'rsub' found" on the server, Am I missing something here? – Angelo Jul 10 '18 at 08:49
-
1If you get the `connect_to localhost port 52698: failed` message even though you did step 3, check to make sure that the port forwarding was successful. If it fails the ssh may still go through but warn that `remote port forwarding failed for listen port 52698`, if that port is not open. – Silenced Temporarily Aug 02 '18 at 19:14
-
4Add `RemoteForward 52698 127.0.0.1:52698` to the .ssh/config file in local machine should solve the connection fail problem caused by port forwarding – Kelvin Sep 15 '18 at 06:43
-
2I cannot install anything on the server, is there another solution? – Herman Toothrot Nov 14 '18 at 16:33
-
-
hint: to edit with sudo I run `which rsub` it give me `/usr/local/bin/rsub`, then just run `sudo /usr/local/bin/rsub file-name` – ericksho Jun 11 '20 at 19:31
-
Does this work for a HPC where you don't have root priviliges? It looks like you permission you are unlikely to have in such a case. – Kvothe Feb 02 '21 at 18:52
-
@Herman, I don't know what not being able to install anything means, but if it just means that you can't install to /usr/local/bin/rsub but you can to some private directory than that is no problem. I just installed it somewhere else and added that directory to the path and it works fine I think. – Kvothe Feb 03 '21 at 10:37
-
So does Sublime text always have to already be open? Is there any work around to make it start when using rsub (or rmate if not renamed) remotely? – Kvothe Feb 03 '21 at 10:39
-
Another thing that might be useful for others, if ST3 is open on server, rsub opens the file on server. Simply, closing ST3 on server fixed the issue, and opened the file on client. – Prefect Jun 16 '21 at 06:44
-
@ugotchi you can try `sublime *.py */.py`. It will open the files but it won't show the directory structure. – irene Feb 15 '23 at 06:16
On macOS, one option is to install FUSE for macOS and use sshfs
to mount a remote directory:
mkdir local_dir
sshfs remote_user@remote_host:remote_dir/ local_dir
Some caveats apply with mounting network volumes, so YMMV.

- 8,717
- 6
- 48
- 50
-
2
-
5@fersarr I don't remember which problems I ran into with this setup, but in general with network mounts one might encounter e.g.: lagginess even with a moderate network connection; editor not being able to watch for changes in files; handling network disruptions.. – tuomassalo Jan 19 '18 at 12:29
-
1
-
2this is the easiest answer ... no need for any subl plugin ... if you are running a linux laptop no need to install FUSE its baked in – Scott Stensland Aug 19 '19 at 00:32

- 682
- 5
- 7
-
This is much better. It doesn't require any installation on the server side. – Shashwat Dec 24 '20 at 10:33
-
2There is nothing worse than having a solution that can only be done by a sudo. We are sudoless people! Good solution ! – Tiago Bruno Feb 19 '22 at 18:27
Base on this.
Step by step:
- On your local workstation: On Sublime Text 3, open Package Manager (Ctrl-Shift-P on Linux/Win, Cmd-Shift-P on Mac, Install Package), and search for rsub
- On your local workstation: Add RemoteForward 52698 127.0.0.1:52698 to your .ssh/config file, or -R 52698:localhost:52698 if you prefer command line
On your remote server:
sudo wget -O /usr/local/bin/rsub https://raw.github.com/aurora/rmate/master/rmate sudo chmod a+x /usr/local/bin/rsub
Just keep your ST3 editor open, and you can easily edit remote files with
rsub myfile.txt
EDIT: if you get "no such file or directory", it's because your /usr/local/bin is not in your PATH. Just add the directory to your path:
echo "export PATH=\"$PATH:/usr/local/bin\"" >> $HOME/.bashrc
Now just log off, log back in, and you'll be all set.

- 433
- 5
- 15
-
1Any way to make this work without sudo privileges on the remote machine? – Kvothe Feb 03 '21 at 10:05