website/content/docs/vagrantfile/winssh_settings.mdx
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
[!IMPORTANT]
Documentation Update: Product documentation previously located in/websitehas moved to thehashicorp/web-unified-docsrepository, where all product documentation is now centralized. Please make contributions directly toweb-unified-docs, since changes to/websitein this repository will not appear on developer.hashicorp.com. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
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.
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
config.winssh.forward_agent (boolean) - If true, 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 the SendEnv parameter.
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.
%h in the command is replaced with the host and %p is replaced with the port.
config.winssh.keep_alive (boolean) - If true, 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 is powershell. Valid values are "cmd" or "powershell".
When the WinSSH provider is enabled, this shell will only be used internally. When
running vagrant ssh you will be provided the shell configured by the guest.
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 a cmd configured shell is:
config.winssh.export_command_template = 'set %ENV_KEY%="%ENV_VALUE%"'
The default template for a powershell configured 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
with sudo. This defaults to %c (assumes vagrant user is an administrator
and needs no escalation). The %c will 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 to C:\Windows\Temp by default.