Skip to content

Override SSH port #53

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

Open
snolahc opened this issue Sep 23, 2015 · 3 comments
Open

Override SSH port #53

snolahc opened this issue Sep 23, 2015 · 3 comments

Comments

@snolahc
Copy link

snolahc commented Sep 23, 2015

Hi,

First thanks for your really useful provider !

i need specific SSH ports to access my servers and the option is not available in the Vagrantfile, the 22 port is hard-coded in the plugin.

Line 24 of provider.rb :
:port => @machine.provider_config.ssh-port

maybe ?
the 22 port is hard-coded in action/read_state.rb but seems unused.

thanks :)

@tknerr
Copy link
Owner

tknerr commented Sep 23, 2015

Indeed this is currently unused:
https://github.com/tknerr/vagrant-managed-servers/blob/master/lib/vagrant-managed-servers/action/read_state.rb#L56

However this one is relevant :
https://github.com/tknerr/vagrant-managed-servers/blob/master/lib/vagrant-managed-servers/provider.rb#L24

We might be able to reuse the builtin config.vm.ssh_port option here (see https://docs.vagrantup.com/v2/vagrantfile/ssh_settings.html) instead of hardcoding to 22.

So much I can tell now, but I can't do much further because other things are currently using up my time...

PR are welcome

@hellonico
Copy link

I needed to run over a ssh tunnel opened on port 9022.

I was going to debug this, but the plugin actually works properly when overriding the ssh port as seen below:

  config.vm.define "thirdbox" do |thirdbox| 

    thirdbox.vm.box = "tknerr/managed-server-dummy"
    thirdbox.vm.provider :managed do |managed, override|
      managed.server = "127.0.0.1"
      override.ssh.username = "niko"
      override.ssh.port = 9022
      override.ssh.private_key_path = "~/.ssh/id_rsa"
    end

  end

@tknerr
Copy link
Owner

tknerr commented Sep 14, 2016

@snolahc does the approach shown by @hellonico work for you?

If not, can you provide a Vagrantfile example where it does not work?

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

3 participants