📜 ⬆️ ⬇️

Remote editing of files in Sublime Text 2 by SSH

It will be about using rmate, a small script that allows you to open a remote document from a console in a local text editor, instead of nano or vim, it was written for TextMate and those who switched to ST2 from this editor will certainly use this tool They won't find a lot of new things in the post, but if you just started using ST2 and the only remote editing tool you heard about, this is an SFTP plugin, welcome to the cat for details.

I just want to clarify, on my Ubuntu remote server, and in front of me, Mac OS X, on other systems I have not tried, if I write about your experience with other OS in the comments, I will be very grateful.

In fact, everything is extremely simple, not as simple as with the mentioned SFTP plugin, but still, even a completely newbie can do it.
The first thing you need to do is install the rsub plugin for ST2 (available via Package Control ), then, if not already created, create a config file in ~ / .ssh and add a few lines to it
Host myhost Hostname <ip-  > RemoteForward 52698 127.0.0.1:52698 

This is necessary to ensure that the tunnel for your server is always created automatically, without the -R switch and forward port declarations. Port 52698 is listened on by the rsub plugin by default, you can use another one.

Now, connect to the remote server.
 ssh myhost # root@myhost 

Download rmate
 curl https://raw.github.com/aurora/rmate/master/rmate > rmate 

Move to / usr / local / bin and give the file permissions to execute
 sudo mv rmate /usr/local/bin sudo chmod +x /usr/local/bin/rmate 

And that's all, works, run ST2 and execute the rmate command instead of the usual nano or vim
 rmate /var/www/test.html #      

')

Source: https://habr.com/ru/post/181299/


All Articles