-
SUBLIME TEXT > éditer un fichier distant via ssh
On va utiliser une version de rmate
1 - sur la machine locale : SublimeText3 > Package Manager (Ctrl-Shift-P on Linux) > Install Package > chercher
rsub
2 - sur la machine locale : dans le fichier .ssh/config ajouter :
RemoteForward 52698 127.0.0.1:52698
ou alors, à chaque connexion ssh :
ssh toto@ip -R 52698:localhost:52698
3 - sur la machine distante :
sudo wget -O /usr/local/bin/rsub https://raw.github.com/aurora/rmate/master/rmate sudo chmod a+x /usr/local/bin/rsub
4 - se reconnecter en ssh
5 - SublimeTexte doit être encore ouvert
6 - sur la machine distante, taper :
rsub myfile.txt
voilà.
ERREURS
no such file or directory
le chemin
/usr/local/binn’est pas dans le PATH. Il faut le rajouter :echo "export PATH=\"$PATH:/usr/local/bin\"" >> $HOME/.bashrc
Se délogger / relogguer, et tout revient dans l’ordre..
—
root@anderskitson:~# rsub monFichier /usr/local/bin/rmate: connect: Connection refused /usr/local/bin/rmate: line 186: /dev/tcp/localhost/52698: Connection refused Unable to connect to TextMate on localhost:52698
in my case, I had a valid
Host audio
line in my .ssh/config file, but I was usingssh music.local
to connect to it (bypassing my ssh alias) and its necessary RemoteForwardmaMachine = IP ou hostname de la machine distante.
ssh -R 52698:localhost:52698 maMachineDistante depuis la machine locale, puis
rmate .profile
on remoteHost worked.Et le fichier ~/.ssh/config to look like this:
Host maMachineDistante RemoteForward 52698 localhost:52698
On peut faire aussi :
ssh toto@192.168.0.1. -R 52698:localhost:5269
Maybe I didn’t read this too well, but just for anyone else who makes my mistake, don’t take “remoteHost” literally.
remoteHost
is just the name of your server block in~/.ssh/config
—so addRemoteForward 52698 localhost:52698
to the end of your block, not as some new block. Swap “remoteHost” for “myServer” or whatever the Host is in your config block.Host * RemoteForward 52698 localhost:52698
I consulted this link: configure SSH config file and realized you can use * in config file.
Wildcards are also available to allow for options that should have a broader scope.For example my SSH config
~/.ssh/config
file to connect with DigitalOcean with Remote Forward looks like:Host DigitalOcean Hostname xxx.xxx.xxx.xxx User username RemoteForward 52698 localhost:52698
and is called in a terminal
ssh DigitalOcean
rmate then connects fine with my local Atom editor
—