<!---
!!!!!! NOTE: CHEF CLIENT BUGS ONLY !!!!!!
This issue tracker is for th…e code contained within this repo -- `chef-client`, base `knife` functionality (not
plugins), `chef-apply`, `chef-solo`, `chef-client -z`, etc.
* Requests for new or alternative functionality should be made to [feedback.chef.io](https://feedback.chef.io/forums/301644-chef-product-feedback/category/110832-chef-client)
* [Chef Server issues](https://github.com/chef/chef-server/issues/new)
* [ChefDK issues](https://github.com/chef/chef-dk/issues/new)
* Cookbook Issues (see the https://github.com/chef-cookbooks repos or search [Supermarket](https://supermarket.chef.io) or GitHub/Google)
-->
## Description
knife bootstrap aksing password, even if -P option is not provided.
eg.
knife bootstrap -U test1 --sudo 10.0.80.1 -F text -N ABCNode --bootstrap-template ~/abc/templates/chef-client-install.erb -E ABCEnv
it prompts:
Connecting to 10.0.80.1
WARNING: Failed to authenticate test1 to 10.0.80.1 - trying password auth
Enter password for test1@10.0.80.1.
Connecting to 10.0.80.1
The authenticity of host '10.0.80.1 ()' can't be established.
fingerprint is SHA256:w+YuqafdJJMTFrrZjeZzEQZiZyDs7f0q0srhxYsdfssfd.
Are you sure you want to continue connecting
? (Y/N) Y
Connecting to 10.0.80.1
WARN: [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user test1@10.0.80.1>)
ERROR: Train::Transports::SSHFailed: SSH session could not be established
## Chef Version
ChefDK version: 4.7.73
Chef Infra Client version: 15.7.32
Chef InSpec version: 4.18.51
Test Kitchen version: 2.3.4
Foodcritic version: 16.2.0
Cookstyle version: 5.20.0
## Platform Version
Linux
## Replication Case
<!--- Tell us what steps to take to replicate your problem. See [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve)
for information on how to create a good replication case. -->
## Client Output
<!--- The relevant output of the chef-client run or a link to a gist of the entire run, if there is one.
The debug output (chef-client -l debug) may be useful, but please link to a gist, or truncate it. -->
```
```
## Stacktrace
-bash-4.2$ knife bootstrap -V -V -U test1 --sudo 10.0.80.1 -F text -N ABCNode --bootstrap-template ~/abc/templates/chef-client-install.erb -E ABCEnv
INFO: Using configuration from ~/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at /etc/chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at /etc/chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
Connecting to 10.0.80.1
WARNING: Failed to authenticate test1 to 10.0.80.1 - trying password auth
Enter password for test1@10.0.80.1.
Connecting to 10.0.80.1
DEBUG: [SSH] test1@10.0.80.1<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>[], :password=>"", :forward_agent=>nil, :non_interactive=>false, :verify_host_key=>:always}> (cmd.exe /c ver)
DEBUG: [SSH] opening connection to test1@10.0.80.1<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>[], :password=>"", :forward_agent=>nil, :non_interactive=>false, :verify_host_key=>:always}>
Connecting to 10.0.80.1
DEBUG: [SSH] test1@10.0.80.1<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>[], :password=>"", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:accept_new}> (cmd.exe /c ver)
DEBUG: [SSH] opening connection to test1@10.0.80.1<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>[], :password=>"", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:accept_new}>
INFO: [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user test1@10.0.80.1>)
DEBUG: [SSH] opening connection to test1@10.0.80.1<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>[], :password=>"", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:accept_new}>
INFO: [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user test1@10.0.80.1>)
DEBUG: [SSH] opening connection to test1@10.0.80.1<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>[], :password=>"", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:accept_new}>
INFO: [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user test1@10.0.80.1>)
DEBUG: [SSH] opening connection to test1@10.0.80.1<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>[], :password=>"", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:accept_new}>
INFO: [SSH] connection failed, retrying in 1 seconds (#<Net::SSH::AuthenticationFailed: Authentication failed for user test1@10.0.80.1>)
DEBUG: [SSH] opening connection to test1@10.0.80.1<{:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>[], :password=>"", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:accept_new}>
WARN: [SSH] connection failed, terminating (#<Net::SSH::AuthenticationFailed: Authentication failed for user test1@10.0.80.1>)
Traceback (most recent call last):
34: from /bin/knife:349:in <main>' 33: from /bin/knife:349:in load'
32: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/bin/knife:24:in <top (required)>' 31: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/application/knife.rb:163:in run'
30: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife.rb:229:in run' 29: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife.rb:485:in run_with_pretty_exceptions'
28: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/local_mode.rb:42:in with_server_connectivity' 27: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife.rb:486:in block in run_with_pretty_exceptions'
26: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap.rb:574:in run' 25: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap.rb:625:in connect!'
24: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap.rb:697:in do_connect' 23: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap/train_connector.rb:70:in connect!'
22: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap/train_connector.rb:57:in connection' 21: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh.rb:82:in connection'
20: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh.rb:240:in create_new_connection' 19: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh.rb:240:in new'
18: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:53:in initialize' 17: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/extras/command_wrapper.rb:166:in load'
16: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/plugins/base_connection.rb:116:in platform' 15: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect.rb:9:in scan'
14: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:27:in scan' 13: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:27:in each'
12: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:33:in block in scan' 11: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:45:in scan_children'
10: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:45:in each' 9: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:46:in block in scan_children'
8: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:46:in instance_eval' 7: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/specifications/os.rb:29:in block in load'
6: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/helpers/os_windows.rb:4:in detect_windows' 5: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/helpers/os_windows.rb:9:in check_cmd'
4: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/plugins/base_connection.rb:128:in run_command' 3: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:223:in run_command_via_connection'
2: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:254:in session' 1: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:185:in establish_connection'
/opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/net-ssh-5.2.0/lib/net/ssh.rb:263:in start': Authentication failed for user test1@10.0.80.1 (Net::SSH::AuthenticationFailed) 34: from /bin/knife:349:in
'
33: from /bin/knife:349:in load' 32: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/bin/knife:24:in <top (required)>'
31: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/application/knife.rb:163:in run' 30: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife.rb:229:in run'
29: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife.rb:485:in run_with_pretty_exceptions' 28: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/local_mode.rb:42:in with_server_connectivity'
27: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife.rb:486:in block in run_with_pretty_exceptions' 26: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap.rb:574:in run'
25: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap.rb:625:in connect!' 24: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap.rb:697:in do_connect'
23: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap/train_connector.rb:70:in connect!' 22: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.7.32/lib/chef/knife/bootstrap/train_connector.rb:57:in connection'
21: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh.rb:82:in connection' 20: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh.rb:240:in create_new_connection'
19: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh.rb:240:in new' 18: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:53:in initialize'
17: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/extras/command_wrapper.rb:166:in load' 16: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/plugins/base_connection.rb:116:in platform'
15: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect.rb:9:in scan' 14: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:27:in scan'
13: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:27:in each' 12: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:33:in block in scan'
11: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:45:in scan_children' 10: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:45:in each'
9: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:46:in block in scan_children' 8: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/scanner.rb:46:in instance_eval'
7: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/specifications/os.rb:29:in block in load' 6: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/helpers/os_windows.rb:4:in detect_windows'
5: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/platforms/detect/helpers/os_windows.rb:9:in check_cmd' 4: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/plugins/base_connection.rb:128:in run_command'
3: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:223:in run_command_via_connection' 2: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:254:in session'
1: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:179:in establish_connection' /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/train-core-3.2.0/lib/train/transports/ssh_connection.rb:189:in rescue in establish_connection': SSH session could not be established (Train::Transports::SSHFailed)