Created
October 21, 2011 11:59
-
-
Save mpasternacki/1303659 to your computer and use it in GitHub Desktop.
Make Chef's `knife ssh` use your actual login name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# knife.rb config snippet to make knife ssh command use your own login | |
# instead of hard-coded `root', `ubuntu' or other name. Tries to get | |
# login for your domain from ~/.ssh/config and if it's not found | |
# there, uses your local login. | |
require 'net/ssh' | |
require 'etc' | |
knife[:ssh_user] = | |
Net::SSH::Config.for('some.host.inside.your.domain')[:user] || | |
Etc.getlogin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment