Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsub with multiple computers in the same server #60

Open
jsmedmar opened this issue Dec 21, 2015 · 13 comments
Open

rsub with multiple computers in the same server #60

jsmedmar opened this issue Dec 21, 2015 · 13 comments

Comments

@jsmedmar
Copy link

I'm trying to use rsub with multiple computers on the same server, however, it only works for one. When I try to use it from other computers, files are opened in the first computer. I tried following the instructions in the Port Forwarding section of this blog. But couldn't solve it. Any suggestions?

@jsmedmar
Copy link
Author

I found a work around, which is described here. I'm wondering why this package does not enable to set user specific settings. Anyway, I truly love rsub. Thank you!

@ghost
Copy link

ghost commented Apr 7, 2016

The workaround you linked doesn't seem to be working for me. Any suggestions?

@jsmedmar
Copy link
Author

@lgsds can you explain further? What are you experiencing? The same file is opening in two computers?
Nothing happening at all? I'll review my SO post to see if I missed something.

@jsmedmar
Copy link
Author

Make sure in this file Packages/User/rsub.sublime-settings you use different ports for the different machines.

@ghost
Copy link

ghost commented Apr 14, 2016

When I follow the post I get the following errors:

~/bin/rsub: connect: Connection refused
~/bin/rsub: line 326: /dev/tcp/localhost/52699: Connection refused
Unable to connect to TextMate on localhost:52699

But when I set it up using the default port, 52698, it works just fine.

@jsmedmar
Copy link
Author

Do you have sublime opened when you try to connect? Perhaps, could you share your settings?

S

On Apr 14, 2016, at 11:20 AM, lgsds [email protected] wrote:

When I follow the post I get the following errors:

~/bin/rsub: connect: Connection refused
~/bin/rsub: line 326: /dev/tcp/localhost/52699: Connection refused
Unable to connect to TextMate on localhost:52699


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

@ghost
Copy link

ghost commented Apr 14, 2016

I do. I set it up using the same settings as the SO post:

# Packages/User/rsub.sublime-settings
// rsub user settings
{
    /*
        rsub listen port.

        IMPORTANT: Use a different port for each machine.
    */
    "port": 52699,

    /*
        rsub listen host

        WARNING: it's NOT recommended to change this option,
        use SSH tunneling instead.
    */
    "host": "localhost"
}

@jsmedmar
Copy link
Author

jsmedmar commented Jun 22, 2016

Hey @lgsds, I went through this process again for one of my colleagues computer and I was having the same issue as you...

Surprisingly, my problem was that I had an extra white space at the end of the name of the rsub settings file, it was called Packages/User/rsub.sublime-settings• (being a white space) instead of Packages/User/rsub.sublime-settings.

Once I fixed that, everything worked as expected. I didn't do anything different from what is described in StackOverflow.

@jsmedmar
Copy link
Author

If you copy pasted the name from the SO post, you are likely to have the same problem because that name had an extra white space (which I just corrected).

@nemeth-it
Copy link

In our case there was two local machines which wanted to connect on the same server and the same user. We solved it by simply duplicate the rmate-script on the remote machine, rename it and change the port-number in the script itself.

All other changes locally was also necessary liked mentioned in this thread. Worked like a charm, but a support for multiple users for the same command would be nice.

@KES777
Copy link
Collaborator

KES777 commented Dec 8, 2017

If you connect over ssh you may export RMATE_PORT environment variable and do remote forward.
Because I am the only user I put this export into ~/.bash_aliases

if [ -z "$SSH_CLIENT" ]; then
        export EDITOR="subl"
else
        export EDITOR="rsub --port 52697"
        export RMATE_PORT="52697"
fi

and also put into ~/.ssh/config next:

host    your_host_alias
        user user_name
        hostname host.domain
        PreferredAuthentications publickey
        port 22
        identityfile /path/to/your/key
        RemoteForward 52697 127.0.0.1:52698

How to pass the ENV variable you can see here

  1. Then each user setup different RMATE_PORT. For example 11111/22222 correspondigly
  2. Fix his ~/.ssh/config with new value
RemoteForward 11111 127.0.0.1:52698

For each connection the environment will have different RMATE_PORT so your two users will not interfere. And do not need to patch rsub and/or create copy or it

hope this helps to you

@magnosis
Copy link

I see how to customize the port, but I fail to understand how to have 1 local Sublime instance able to edit files on multiple remote servers at once.

Every time I open an SSH connection to 2nd, 3rd, etc. remote hosts, the previous hosts cannot connect to Sublime. One local Sublime port won't accept connection from multiple remote hosts.

Is this possible at all? Can I get sublime to open, say, 10 ports, 1 for each of 10 remote hosts?

@KES777
Copy link
Collaborator

KES777 commented Sep 26, 2019

@magnosis

One local Sublime port won't accept connection from multiple remote hosts.

You are wrong here. The sublime when listening port 52698 (actually rmate plugin) it acts like server. and can accept unlimited count of connections from different remote hosts. In same way as for example your DB server.

Is this possible at all? Can I get sublime to open, say, 10 ports, 1 for each of 10 remote hosts?

yes that is possible. I have described here how

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants