81

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?

1

4 Answers 4

195

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

  1. 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

  1. Open command line and connect to remote server:

ssh -R 52698:localhost:52698 server_user@server_address

  1. after connect to server run this command on server:

rsub path_to_file/file.txt

  1. 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.

Sign up to request clarification or add additional context in comments.

17 Comments

Managed 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?
after doing the last step, on ST3, the file does not open automagically. Is there something I am missing here ?
What error you get? connect_to localhost port 52698: failed.? If so, you should open "Sublime Text" first then execute step 3.
Add 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
I cannot install anything on the server, is there another solution?
|
34

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.

4 Comments

could you describe the caveats please?
@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..
That's not limited to macOS though
this 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
15

You can use these plugins;

Sublime SFTP

sublime FTPSync

2 Comments

This is much better. It doesn't require any installation on the server side.
There is nothing worse than having a solution that can only be done by a sudo. We are sudoless people! Good solution !
1

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.

1 Comment

Any way to make this work without sudo privileges on the remote machine?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.