Skip to content

Instantly share code, notes, and snippets.

@elsauto
Last active February 15, 2018 22:38
Show Gist options
  • Save elsauto/e70f1876026c8c6dd10f14aa97bef935 to your computer and use it in GitHub Desktop.
Save elsauto/e70f1876026c8c6dd10f14aa97bef935 to your computer and use it in GitHub Desktop.
[Edit a remote file via a ssh connection with Sublime] #ssh #remote #hack #tricks #tips #developer

Edit file on remote server with Sublime.

  1. On the server side (in my case, Ubuntu) install rsub:

     wget -O /usr/local/bin/rsub \https://raw.github.com/aurora/rmate/master/rmate
     chmod a+x /usr/local/bin/rsub
    
  2. On the local side (again in my case macOS High Sierra 10.13.3) 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. Install it

  3. Open command line and connect to remote server:

     ssh -R 52698:localhost:52698 server_user@server_address -p portnumber
    
  4. After connecting to the remote server, run this command:

     rsub path_to_file/file.txt
    

Then file opening automatically in Sublime 3. Side Note: sublime must be already open before you go trough this.

Credit where its due, Stackoverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment