core: error if vagrant ssh -c with password

This commit is contained in:
Mitchell Hashimoto 2014-01-03 11:26:41 -08:00
parent 54e640b0c9
commit 92413d0393
3 changed files with 22 additions and 5 deletions

View File

@ -26,11 +26,15 @@ module Vagrant
# not yet ready for SSH, so we raise this exception.
raise Errors::SSHNotReady if info.nil?
if info[:private_key_path]
info[:private_key_path] ||= []
# Check SSH key permissions
info[:private_key_path].each do |path|
SSH.check_key_permissions(Pathname.new(path))
end
if info[:private_key_path].empty?
raise Errors::SSHRunRequiresKeys
end
# Get the command and wrap it in a login shell

View File

@ -532,6 +532,10 @@ module Vagrant
error_key(:ssh_port_not_detected)
end
class SSHRunRequiresKeys < VagrantError
error_key(:ssh_run_requires_keys)
end
class SSHUnavailable < VagrantError
error_key(:ssh_unavailable)
end

View File

@ -650,6 +650,15 @@ en:
Please make sure that you have a forwarded port that goes to the configured
guest port value, or specify an explicit SSH port with `config.ssh.port`.
ssh_run_requires_keys: |-
Using `vagrant ssh -c` requires key-based SSH authentication, but your
Vagrant environmet is configured to use only password-based authentication.
Please configure your Vagrantfile with a private key to use this
feature.
Note that Vagrant can automatically insert a keypair and use that
keypair for you. Just set `config.ssh.insert_key = true` in your
Vagrantfile.
ssh_unavailable: "`ssh` binary could not be found. Is an SSH client installed?"
ssh_unavailable_windows: |-
`ssh` executable not found in any directories in the %PATH% variable. Is an