Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a full set of recipes that are working to bootstrap a server at Rackspace, it configures and installs everything as needed. Now, I want to change the default port SSH runs on. This is fairly easy to do, but the question is, how do I tell Knife to use 22 when bootstrapping, but the non standard port when doing everything else on registered nodes?

share|improve this question
1  
talked with the people in #chef on FreeNode and figured it out. When bootstrapping, I need to pass -c myboostrap.config where i have a setting saying knife[:ssh_port] = '22' –  Vid Luther Jul 20 '11 at 23:46
    
thanks to bemu on irc :) –  Vid Luther Jul 20 '11 at 23:47
1  
Add an answer and accept it, so others can learn from your experience. –  womble Jul 20 '11 at 23:53

1 Answer 1

This has been in chef since version 0.9.16. You can configure the port by adding the following to your .chef/knife.rb.

knife[:ssh_port] = '22'

Change 22 to the port you want. You don't need to pass -c to the knife bootstrap command if your configuration is in .chef/knife.rb in the current directory.

Ticket for this feature.

Commit for the change.

More information on configuring knife can be found on the Chef wiki:

share|improve this answer
    
jtimberman, I saw the knife[:ssh_port] option, but the issue is I change the port to non 22, AFTER the bootstrap, so in knife.rb, I have the non standard port, but in the bootstrap it's still 22. Since the machine boots up at 22. Or maybe I'm not understanding what you're saying? (more than likely :)). Hope to see you or someone from your team at OSCON later this week. –  Vid Luther Jul 24 '11 at 15:34
    
I wouldn't bother with changing the port as setting SSH to run on an alternate port doesn't really increase security. An attacker of any sophistication (or one who wants to find out if you're running vulnerable SSH) is going to scan all the ports available. –  jtimberman Aug 2 '11 at 4:06
    
I'm not changing ports for "security" like that, we're running proftpd with mod_sftp on port 22, and on a non standard port which would be needed for chef, and actual ssh only. –  Vid Luther Aug 3 '11 at 20:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.