Knife ssh - different port for single host


#1

Hi,

we have one host, which runs sshd on a different port.

I found http://tech.picklive.com/2011/11/15/knife-ssh-config-options.html, but this works only on a global scope.

Is it possible to change the port for a single host?
~/.ssh/config is unfortunately not interpreted.

Thanks for your reply
Steffen


#2

Host foo.bar.example.com
Port 6670

On Thursday, November 1, 2012 at 5:38 AM, Steffen Gebert wrote:

Hi,

we have one host, which runs sshd on a different port.

I found http://tech.picklive.com/2011/11/15/knife-ssh-config-options.html, but this works only on a global scope.

Is it possible to change the port for a single host?
~/.ssh/config is unfortunately not interpreted.

Thanks for your reply
Steffen


#3

Sadly, I don’t think is is possible without a patch.

Best,
Adam

On Nov 1, 2012, at 5:38 AM, Steffen Gebert st+opscode@st-g.de wrote:

Hi,

we have one host, which runs sshd on a different port.

I found http://tech.picklive.com/2011/11/15/knife-ssh-config-options.html, but this works only on a global scope.

Is it possible to change the port for a single host?
~/.ssh/config is unfortunately not interpreted.

Thanks for your reply
Steffen


#4

Seems “not too hard” (by someone who is not volunteering to do it) to
use Net::SSH::Config class for this, right?
http://net-ssh.github.com/ssh/v2/api/classes/Net/SSH/Config.html

On Thu, Nov 1, 2012 at 12:30 PM, Adam Jacob adam@opscode.com wrote:

Sadly, I don’t think is is possible without a patch.

Best,
Adam

On Nov 1, 2012, at 5:38 AM, Steffen Gebert st+opscode@st-g.de wrote:

Hi,

we have one host, which runs sshd on a different port.

I found http://tech.picklive.com/2011/11/15/knife-ssh-config-options.html, but this works only on a global scope.

Is it possible to change the port for a single host?
~/.ssh/config is unfortunately not interpreted.

Thanks for your reply
Steffen


#5

The docs say they are read by default?

Adam

On Nov 1, 2012, at 9:47 AM, Mike miketheman@gmail.com wrote:

Seems “not too hard” (by someone who is not volunteering to do it) to
use Net::SSH::Config class for this, right?
http://net-ssh.github.com/ssh/v2/api/classes/Net/SSH/Config.html

On Thu, Nov 1, 2012 at 12:30 PM, Adam Jacob adam@opscode.com wrote:

Sadly, I don’t think is is possible without a patch.

Best,
Adam

On Nov 1, 2012, at 5:38 AM, Steffen Gebert st+opscode@st-g.de wrote:

Hi,

we have one host, which runs sshd on a different port.

I found http://tech.picklive.com/2011/11/15/knife-ssh-config-options.html, but this works only on a global scope.

Is it possible to change the port for a single host?
~/.ssh/config is unfortunately not interpreted.

Thanks for your reply
Steffen


#6

On Thu, Nov 1, 2012 at 8:38 AM, Steffen Gebert st+opscode@st-g.de wrote:

Is it possible to change the port for a single host?
~/.ssh/config is unfortunately not interpreted.

On Thu, Nov 1, 2012 at 11:45 AM, John Dewey john@dewey.ws wrote:

Host foo.bar.example.com
Port 6670

This works, except we break it by sending port 22 to Net::SSH:Multi
even if we don’t specify it explicitly.

Delete the line below from ssh.rb and it will work.

http://tickets.opscode.com/browse/CHEF-3577

Bryan

— /home/btm/src/chef/chef/lib/chef/knife/ssh.rb 2012-10-31
11:42:20.351186646 -0700
+++ /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.2/lib/chef/knife/ssh.rb 2012-11-01
13:32:18.290876884 -0700
@@ -72,7 +72,6 @@
:short => “-p PORT”,
:long => “–ssh-port PORT”,
:description => “The ssh port”,

  •    :default => "22",
       :proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key }
    
     option :ssh_gateway,