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 stackoverflow.com/questions/15958056/… I implemented the tenth answer (winscp part) of this question.. – Raman Balyan May 27 '16 at 7:08
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.
-
2
-
4
-
24Managed 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
-
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
-
6What error you get?
connect_to localhost port 52698: failed.
? If so, you should open "Sublime Text" first then execute step 3. – igaurav Jan 4 '18 at 16:05
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.
-
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 0:32
-
This is much better. It doesn't require any installation on the server side. – Shashwat Dec 24 '20 at 10:33
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.