A Windows implementation of sshpass, providing similar functionality to the Linux sshpass tool.
- SSH login with password or private key authentication
- Execute remote commands or open interactive shell
- File upload/download via SFTP (with progress bar)
- SCP-style and Rsync-style file transfer
- Config file support for managing multiple servers
- Dynamic terminal resizing in interactive shell mode
- Git Bash path conversion detection and auto-fix
- IPv6 address support
Download the latest release from GitHub Releases:
- Go to Releases page
- Download
win-sshpass.exe(zip) orwin-sshpass-v*.msi(installer) - If using MSI: run the installer — it will add the install directory to your system PATH automatically
Zero dependencies:
win-sshpass.exeis 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.
# Password login and execute command
win-sshpass -p 'password' ssh user@example.com 'whoami'
# Private key login and execute command
win-sshpass -i ~/.ssh/id_ed25519 ssh user@example.com 'hostname'
# Upload file
win-sshpass -h example.com -p 'password' -local file.txt -remote /tmp/file.txt
# Download file
win-sshpass -h example.com -p 'password' -d -remote /tmp/file.txt -local ./file.txt# Password authentication
win-sshpass -p <password> ssh [user@host] [command]
win-sshpass -p <password> ssh -p <port> user@host 'command'
win-sshpass -p <password> ssh -o StrictHostKeyChecking=no user@host
# Private key authentication
win-sshpass -i <private_key_path> ssh [user@host] [command]
# Password from environment variable
SSHPASS=<password> win-sshpass -e ssh user@host
# Password from file
echo 'password' > pass.txt
win-sshpass -f pass.txt ssh user@host
# Configuration file (multi-line format)
win-sshpass -f server.config# Upload file
win-sshpass -h <host> -p <password> -local <local_path> -remote <remote_path>
# Upload multiple files (comma-separated)
win-sshpass -h <host> -p <password> -local "a.txt,b.txt,c.txt" -remote /tmp/
# Upload multiple files (space-separated, only for simple paths without / or \)
win-sshpass -h <host> -p <password> -local "a.txt b.txt c.txt" -remote /tmp/
# Upload directory (auto-recursive)
win-sshpass -h <host> -p <password> -local <local_dir> -remote <remote_dir>
# Download file/directory
win-sshpass -h <host> -p <password> -d -remote <remote_path> -local <local_path>win-sshpass -p <password> scp <local_file> user@host:<remote_path>
win-sshpass -p <password> scp -P <port> <local_file> user@host:<remote_path>
win-sshpass -p <password> scp user@host:<remote_file> <local_path>win-sshpass -p <password> rsync -avz <local_path> user@host:<remote_path>| Parameter | Description | Example |
|---|---|---|
-p |
Password | -p 'secret123' |
-i |
Private key path | -i ~/.ssh/id_ed25519 |
-f |
Password file / config file | -f pass.txt |
-e |
Read password from SSHPASS env var | SSHPASS='pass' win-sshpass -e ssh ... |
-h |
Host address | -h example.com |
-u |
Username, default: root | -u ubuntu |
-P |
Port, default: 22 | -P 2222 |
-c |
Command to execute | -c 'ls -la' |
-local |
Local path(s) (comma or space separated) | -local "a.txt,b.txt" |
-remote |
Remote path (upload/download) | -remote /tmp/file.txt |
-d |
Download mode | -d |
-k |
Enable strict host key verification | -k |
-v |
Show version | -v |
host: example.com
username: root
password: your_password
port: 22
# key: ~/.ssh/id_ed25519 # optional, use private key instead of passwordUsage:
win-sshpass -f server.config -c 'ls -la'# 1. Password login and execute command
win-sshpass -p 'mypass' ssh root@192.168.1.100 'docker ps'
# 2. Private key login and execute sudo command
win-sshpass -i ~/.ssh/id_ed25519 ssh ubuntu@server.com 'sudo systemctl restart nginx'
# 3. Upload entire directory to server
win-sshpass -h server.com -p 'mypass' -local ./dist -remote /var/www/html
# 4. Download server log directory
win-sshpass -h server.com -p 'mypass' -d -remote /var/log/nginx -local ./logs
# 5. SCP upload file
win-sshpass -p 'mypass' scp ./app.jar user@server.com:/opt/app/
# 6. Password via environment variable (more secure)
export SSHPASS='mypass'
win-sshpass -e ssh user@server.com 'whoami'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.txtgo build -o win-sshpass.exe .- Go 1.23+
- golang.org/x/crypto/ssh
- github.com/pkg/sftp
- github.com/schollz/progressbar/v3