diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 64d1d0c378d..a4095e84026 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -378,7 +378,7 @@ def ssh_command command = render_template if config[:use_sudo] - command = config[:use_sudo_password] ? "echo '#{config[:ssh_password]}' | sudo -S #{command}" : "sudo #{command}" + command = config[:use_sudo_password] ? "echo '#{config[:ssh_password]}' | sudo -SH #{command}" : "sudo -H #{command}" end command