win-sshpass: A Cross-Platform SSH Password Authentication Tool
Introduction:
win-sshpass is a cross-platform implementation of sshpass designed to facilitate SSH password authentication on both Windows and Linux. It offers seamless integration for users requiring secure SSH access across different operating systems.
Key Features:
SFTP/SCP File Transfers: Supports file transfers with progress bars, ensuring visibility into transfer status.
Rsync-Style Syncing: Enables efficient file synchronization akin to rsync, optimizing data transfer processes.
Interactive Shell Access: Provides direct access to remote shells for command execution and scripting.
Proxy Tunneling: Facilitates secure connections through SOCKS4/5 or HTTP/HTTPS proxies, enhancing network flexibility.
Breakpoint-Resume Functionality: Allows resuming interrupted transfers, saving time on large file operations.
File Verification: Includes hashing and verification features for data integrity checks post-transfer.
Config File Support: Offers flexible configuration options to customize SSH sessions according to specific needs.
Target Audience and Benefits:
Ideal for developers, DevOps engineers, and system administrators who require efficient SSH authentication across platforms. win-sshpass simplifies file transfers, enhances security with password or private key authentication, and provides flexibility through config file support. Easily installable via Winget, it streamlines deployment processes, ensuring seamless integration into existing workflows.
This tool is perfect for those seeking reliable, cross-platform SSH solutions that enhance productivity and operational efficiency.
README
Related Project
go-web-frame — Effortless auth: declare required permissions on routes, verify once in a Filter, keep handlers clean. Generic Model for full-stack CRUD: define a struct, and create/read/update/delete just works. Lightweight, install only the components you need. No code generation, no CI tooling required — the most elegant Go web full-stack framework.
Download the package for your platform and architecture
Windows MSI: run the installer — it will add the install directory to your system PATH automatically
Windows Zip / Linux tar.gz: extract and place the binary in your PATH
> Zero dependencies: win-sshpass.exe is a standalone binary. No need to install OpenSSH or any other software. Download it, put it in your PATH, and you're ready to go.
When no command is specified, win-sshpass opens an interactive shell with raw terminal mode:
win-sshpass -p 'password' ssh user@host
Raw terminal mode features:
Proper echo — typed characters are displayed correctly (no double echo)
Ctrl+C / Ctrl+Z — signals are forwarded to the remote process
Full-screen apps — vim, top, htop, nano, etc. work correctly
Dynamic terminal resizing — the remote terminal automatically matches your local window size
Tab completion — remote shell tab completion works as expected
File Transfer in Interactive Shell
While connected, use rz / sz commands to transfer files (no need to install anything on the remote server):
# Upload file to remote current directory (opens file picker)
rz
# Upload specific local file
rz /local/path/to/file
# Download remote file (opens save dialog)
sz /remote/path/to/file
# Download remote file to specific local path
sz /remote/path/to/file /local/save/path
> How it works: When the remote shell reports rz/sz: command not found, the tool intercepts it and performs the transfer over SFTP instead. Files and directories are both supported, with progress bars.
Use // prefix for remote paths to avoid path conversion:
# Wrong: /tmp will be converted to Windows path
win-sshpass ... -remote /tmp/file.txt
# Correct: use double slashes
win-sshpass ... -remote //tmp/file.txt
Use as a Go SDK
win-sshpass is also a reusable Go library (package sshpass). Import it to
embed SSH/SFTP/shell capabilities in your own application:
go get github.com/chuccp/win-sshpass
package main
import (
"log"
sshpass "github.com/chuccp/win-sshpass"
)
func main() {
cfg := sshpass.NewConfig()
cfg.Host = "example.com"
cfg.User = "root"
cfg.Password = "secret"
// NewClient dials and returns a ready-to-use client.
client, err := sshpass.NewClient(cfg, sshpass.WithSignalHandler())
if err != nil {
log.Fatal(err)
}
defer client.Close()
// Execute a command (output streams to os.Stdout/os.Stderr by default).
if err := client.Exec("uname -a"); err != nil {
log.Fatal(err)
}
// Upload a file over SFTP.
sftp, err := client.SFTP()
if err != nil {
log.Fatal(err)
}
defer sftp.Close()
if err := sftp.Upload("./local.txt", "/tmp/remote.txt"); err != nil {
log.Fatal(err)
}
}
Customization options
Behavior is configured through functional options passed to NewClient:
Set a ProgressFunc callback that receives (description string, sent, total int64) during SFTP transfers. The SDK performs no rendering — callers display progress however they like. Defaults to none (headless-friendly).
WithFileSelector(s)
Set the FileSelector used by the rz/sz shell-transfer fallback. The SDK ships no default implementation; without one, rz/sz prompts for a path on stdin.
WithSignalHandler()
Register a Ctrl+C handler that closes the connection. Off by default so the library never interferes with host signal handling.
The SDK intentionally bundles no UI code (no progress bar, no file dialog).
Those concerns live in the CLI package (cmd/sshpass/ui.go), which wires a
progressbar-based ProgressFunc and a zenity-based FileSelector into the
client. Library users provide their own.
To tunnel the SSH connection through a proxy, set Config.ProxyURL before
calling NewClient: