Windows commands that run over SSH are wrapped in a script that writes a special marker to the two output streams (stdout and stderr). This allows Vagrant to consume the output streams. Unfortunately, this leads to a sort of chicken-and-egg problem where no commands can be run before a wrapper script exists. For example, you can't make a destination directory to upload the wrapper script without first creating a wrapper script to make the directory. :) This commit changes the behavior of the WinSSH communicator to assume that the destination directory already exists for provisioning scripts. It also moves the default `upload_path` from the shell provisioner config so we can have OS-specific defaults. Finally, it introduces a Windows-specific #upload method which will properly use a Windows path separator on a non-Windows host.
3.2 KiB
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| docs | config.winssh - Vagrantfile | vagrantfile-winssh | The settings within "config.winssh" relate to configuring how Vagrant will access your machine over Windows OpenSSH. As with most Vagrant settings, the defaults are typically fine, but you can fine tune whatever you would like. |
WinSSH
The WinSSH communicator is built specifically for the Windows native port of OpenSSH. It does not rely on a POSIX-like environment which removes the requirement of extra software installation (like cygwin) for proper functionality.
For more information, see the Win32-OpenSSH project page.
WinSSH Settings
The WinSSH communicator uses the same connection configuration options as the SSH communicator. These settings provide the information for the communicator to establish a connection to the VM.
The configuration options below are specific to the WinSSH communicator.
Config namespace: config.winssh
Available Settings
-
config.winssh.forward_agent(boolean) - Iftrue, agent forwarding over SSH connections is enabled. Defaults to false. -
config.winssh.forward_env(array of strings) - An array of host environment variables to forward to the guest. If you are familiar with OpenSSH, this corresponds to theSendEnvparameter.config.winssh.forward_env = ["CUSTOM_VAR"] -
config.winssh.proxy_command(string) - A command-line command to execute that receives the data to send to SSH on stdin. This can be used to proxy the SSH connection.%hin the command is replaced with the host and%pis replaced with the port. -
config.winssh.keep_alive(boolean) - Iftrue, this setting SSH will send keep-alive packets every 5 seconds by default to keep connections alive. -
config.winssh.shell(string) - The shell to use when executing SSH commands from Vagrant. By default this iscmd. Valid values are"cmd"or"powershell". When the WinSSH provider is enabled, this shell will be used when you runvagrant ssh. -
config.winssh.export_command_template(string) - The template used to generate exported environment variables in the active session. This can be useful when using a Bourne incompatible shell like C shell. The template supports two variables which are replaced with the desired environment variable key and environment variable value:%ENV_KEY%and%ENV_VALUE%. The default template for acmdconfigured shell is:config.winssh.export_command_template = 'set %ENV_KEY%="%ENV_VALUE%"'The default template for a
powershellconfigured shell is:config.winssh.export_command_template = '$env:%ENV_KEY%="%ENV_VALUE%"' -
config.winssh.sudo_command(string) - The command to use when executing a command withsudo. This defaults to%c(assumes vagrant user is an administrator and needs no escalation). The%cwill be replaced by the command that is being executed. -
config.winssh.upload_directory(string) - The upload directory used on the guest to store scripts for execute. This is set toC:\Windows\Tempby default. Vagrant will not attempt to create this directory, so it must already exist on the guest.