Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HPR-888] ssh: use sftp by default for transferring files #160

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@
The `~` can be used in path and will be expanded to the
home directory of current user.

- `ssh_file_transfer_method` (string) - `scp` or `sftp` - How to transfer files, Secure copy (default) or SSH
File Transfer Protocol.
- `ssh_file_transfer_method` (string) - `scp` or `sftp` - How to transfer files, Secure copy or SSH File Transfer
Protocol (default).

**NOTE**: Guests using Windows with Win32-OpenSSH v9.1.0.0p1-Beta, scp
(the default protocol for copying data) returns a a non-zero error code since the MOTW
cannot be set, which cause any file transfer to fail. As a workaround you can override the transfer protocol
with SFTP instead `ssh_file_transfer_protocol = "sftp"`.
returns a a non-zero error code since the MOTW cannot be set, which causes
any file transfer to fail. As a workaround you can override the transfer
protocol with SFTP instead `ssh_file_transfer_protocol = "sftp"`.

- `ssh_proxy_host` (string) - A SOCKS proxy host to use for SSH connection

Expand Down
12 changes: 6 additions & 6 deletions communicator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ type SSH struct {
// The `~` can be used in path and will be expanded to the
//home directory of current user.
SSHBastionCertificateFile string `mapstructure:"ssh_bastion_certificate_file"`
// `scp` or `sftp` - How to transfer files, Secure copy (default) or SSH
// File Transfer Protocol.
// `scp` or `sftp` - How to transfer files, Secure copy or SSH File Transfer
// Protocol (default).
//
// **NOTE**: Guests using Windows with Win32-OpenSSH v9.1.0.0p1-Beta, scp
// (the default protocol for copying data) returns a a non-zero error code since the MOTW
// cannot be set, which cause any file transfer to fail. As a workaround you can override the transfer protocol
// with SFTP instead `ssh_file_transfer_protocol = "sftp"`.
// returns a a non-zero error code since the MOTW cannot be set, which causes
// any file transfer to fail. As a workaround you can override the transfer
// protocol with SFTP instead `ssh_file_transfer_protocol = "sftp"`.
SSHFileTransferMethod string `mapstructure:"ssh_file_transfer_method"`
// A SOCKS proxy host to use for SSH connection
SSHProxyHost string `mapstructure:"ssh_proxy_host"`
Expand Down Expand Up @@ -513,7 +513,7 @@ func (c *Config) prepareSSH(ctx *interpolate.Context) []error {
}

if c.SSHFileTransferMethod == "" {
c.SSHFileTransferMethod = "scp"
c.SSHFileTransferMethod = "sftp"
}

// Backwards compatibility
Expand Down