Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening file with Sublime Text via SSH to VM, error

I do my dev work on a Mac OSX machine with a Ubuntu Server Virtual Machine installed, which I manage mostly by SSHing into it from Terminal. I am trying to find a way to edit files on the server using Sublime Text on the Mac rather than nano or vim from Terminal. I have followed the instructions contained in this excellent guide, "Using Textmate 2s rmate with Sublime Text 2".

  • I've installed rsub in Sublime Text.
  • I've installed rmate on my Ubuntu server.
  • I've edited my ~/.ssh/config file.
  • I've added port 52698 to iptables on the server.

When I SSH into my server and run

rmate .profile

I get the error

connect_to localhost port 52698: failed.

This previous question refers to a similar error, but it appears to be related to having more than one SSH connection open, and I don't think that is the case for me. How could I test for that, though?

I was wondering if this could be somehow related to the fact that my dev server is a Virtual Machine with a slightly arcane internet set-up - using three different adapters that connect to the host machine's ethernet and WiFi connections. Would reverse tunnelling over SSH require different tweaking with this set-up?

Or, any other suggestions for resources or references to get this set up?

like image 550
Ila Avatar asked Dec 13 '12 03:12

Ila


3 Answers

  1. issue the following command to check if port is opened in VM :

    telnet localhost 52698

If not opened then you need to open it.

like image 175
Satya Avatar answered Oct 01 '22 16:10

Satya


In VirtualBox > Settings > Network > Adapter 2 (the NAT adapter) > Advanced, I added a Port Forwarding rule with hostmachine:52698 to the guestmachine:52698. This appears to have resolved it.

like image 27
Ila Avatar answered Oct 01 '22 17:10

Ila


If you want to avoid port-forwarding completely, you can try something I've been working on called 'xeno' (https://xeno.io). It's very similar to rmate/rsub, except that it does not use reverse port-forwarding to enable synchronization. Instead, it uses a mashup of Git and SSH to enable its transport and synchronization. This gives it a number of advantages over rmate/rsub - in particular you can edit entire folder hierarchies. It is also completely robust to connection drop-outs, so you can even work offline and have editing changes you've made locally automatically pushed to the remote once you are back online.

It's also free and open source :), and I'd really love some feedback.

like image 25
havoc-io Avatar answered Oct 01 '22 18:10

havoc-io