Overview
SSHFS (SSH Filesystem) allows you to mount remote directories over SSH on Windows, creating a network drive that behaves like a local filesystem. This is particularly useful for developers working with remote Linux servers, enabling seamless file access without manual file transfers.
Key Benefits:
- Real-time file synchronization
- Uses existing SSH authentication (password or key-based)
- No additional server-side configuration required
- Works with any SSH-enabled server
- Supports Windows Explorer integration
Prerequisites
Before installing SSHFS-Win, ensure you have:
- Windows 10 version 1803 or later (Windows 11 recommended)
- Administrator privileges for installation
- Active SSH connection to the remote server
- WinFsp (Windows File System Proxy) - automatically installed with SSHFS-Win
Install SSHFS
SSHFS-Win is built on top of WinFsp, which provides the kernel-mode filesystem driver that enables user-mode filesystems on Windows. The installation package includes both components.
1winget install SSHFS-Win.SSHFS-WinAlternative Installation Methods:
Using Chocolatey:
1choco install sshfsManual Installation:
- Download from GitHub Releases
- Install WinFsp first (included in installer)
- Install SSHFS-Win
Post-Installation Verification:
1# Check if SSHFS service is running2Get-Service | Where-Object {$_.Name -like "*sshfs*"}3
4# Verify WinFsp installation5Get-ItemProperty HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.DisplayName -like "*WinFsp*"}Mount folder
The \\sshfs\ prefix is a special UNC path that SSHFS-Win recognizes. When you access this path, Windows redirects the request to the SSHFS-Win service, which establishes an SSH connection and translates filesystem operations.
1net use Z: \\sshfs\user@host\path2
3# or4
5\\sshfs\[email protected]Advanced Mounting Options
Mount with Custom SSH Port
If your SSH server runs on a non-standard port (default is 22):
1# Using port 22222net use Z: \\sshfs\user@host!2222\path3
4# Example with IP address and custom port5net use Y: \\sshfs\[email protected]!2222\home\adminMount with SSH Key Authentication
For key-based authentication, SSHFS-Win uses the SSH agent or looks for keys in %USERPROFILE%\.ssh\:
1# Ensure your private key is loaded in the SSH agent2ssh-add "C:\Users\YourName\.ssh\id_rsa"3
4# Then mount normally5net use Z: \\sshfs\user@host\pathMount with Specific Options
You can pass additional SSH options using the extended syntax:
1# Mount with specific identity file2net use Z: "\\sshfs\user@host\path?IdentityFile=C:\Users\YourName\.ssh\custom_key"3
4# Mount with compression enabled (faster for slow connections)5net use Z: "\\sshfs\user@host\path?Compression=yes"6
7# Combine multiple options8net use Z: "\\sshfs\user@host!2222\path?IdentityFile=C:\ssh\key&Compression=yes"Mounting at Startup
Using Task Scheduler
Create a PowerShell script for automatic mounting at login:
1# Save as: mount-ssh-drives.ps12
3# Define your mount points4$mounts = @(5 @{6 Drive = "Z:"7 Path = "\\sshfs\[email protected]\home\user"8 },9 @{10 Drive = "Y:"11 Path = "\\sshfs\[email protected]\var\www"12 }13)14
15foreach ($mount in $mounts) {16 try {17 # Check if drive already exists18 if (!(Test-Path $mount.Drive)) {19 net use $mount.Drive $mount.Path /persistent:yes20 Write-Host "Mounted $($mount.Drive) successfully"21 } else {22 Write-Host "$($mount.Drive) already mounted"23 }24 } catch {25 Write-Warning "Failed to mount $($mount.Drive): $_"26 }27}Make Mount Persistent
To automatically reconnect the drive after reboot:
1# Enable persistent connection2net use Z: \\sshfs\user@host\path /persistent:yes3
4# List all persistent connections5net use6
7# Remove a persistent connection8net use Z: /deleteTroubleshooting
Common Issues and Solutions
Connection Timeout:
1# Increase timeout (in seconds)2net use Z: "\\sshfs\user@host\path?ServerAliveInterval=60&ServerAliveCountMax=3"Permission Denied:
1# Check SSH connection first2ssh user@host3
4# Verify file permissions on remote server5ssh user@host "ls -la /path/to/folder"Drive Letter Already in Use:
1# List all mapped drives2net use3
4# Disconnect specific drive5net use Z: /delete6
7# Or disconnect all network drives8net use * /deletePerformance Optimization
For Large File Operations:
1# Enable caching and increase buffer size2net use Z: "\\sshfs\user@host\path?cache_timeout=115200&cache=yes"For Better Compatibility:
1# Use SFTP subsystem explicitly2net use Z: "\\sshfs\user@host\path?ssh_command=sftp"Monitoring and Management
Check Mount Status
1# View detailed information about mounted drives2Get-PSDrive -PSProvider FileSystem | Where-Object {$_.DisplayRoot -like "*sshfs*"}3
4# View network statistics5net use Z:6
7# Test connectivity8Test-NetConnection -ComputerName host -Port 22Unmounting
1# Graceful unmount2net use Z: /delete3
4# Force unmount if drive is busy5net use Z: /delete /yes6
7# Unmount all network drives8net use * /delete /yesSecurity Considerations
- SSH Key Management: Always use SSH keys with passphrases instead of password authentication
- Host Key Verification: Ensure the remote host's fingerprint is verified on first connection
- Network Security: Use VPN when accessing SSH servers over untrusted networks
- Credential Storage: SSHFS-Win uses Windows Credential Manager; review stored credentials regularly:
powershell1cmdkey /list | Select-String "sshfs"
Integration with Windows Explorer
After mounting, the SSH folder appears in Windows Explorer like any other drive:
- Quick Access: Pin frequently used SSH drives to Quick Access
- Search: Windows Search indexes mounted drives (can be disabled for privacy)
- File Operations: Drag-and-drop, copy-paste work seamlessly
- Context Menu: Right-click operations are supported
Comparison with Alternatives
| Feature | SSHFS-Win | WinSCP | Mapped SMB |
|---|---|---|---|
| Mount as Drive | ✅ Yes | ❌ No | ✅ Yes |
| SSH Protocol | ✅ Yes | ✅ Yes | ❌ No |
| Windows Explorer Integration | ✅ Full | ⚠️ Partial | ✅ Full |
| Performance | ⚠️ Medium | ✅ High | ✅ High |
| Setup Complexity | ✅ Low | ⚠️ Medium | ⚠️ Medium |
| Cross-platform | ✅ Yes | ❌ Windows only | ⚠️ Limited |
Additional Resources
- WinFsp Documentation: https://github.com/winfsp/winfsp
- SSHFS-Win GitHub: https://github.com/winfsp/sshfs-win
- SSH Configuration: https://www.ssh.com/academy/ssh/config