Table of Contents
- What Are the Most Reliable Steps to Map a Network Drive With SSHFS on Windows? (Essential Guide)
- Key Benefits
- Prerequisites
- Installation Steps
- Step 1: Install Required Packages
- Step 2: Map Network Drive Using Windows Explorer
- Step 3: Map Network Drive Using Command Prompt
- Step 4: Map Drives Using SSHFS-Win Manager (GUI)
- Step 5: Automate Drive Mapping at Logon
- Tips and Best Practices
- Troubleshooting
What Are the Most Reliable Steps to Map a Network Drive With SSHFS on Windows? (Essential Guide)
Mapping a network drive over SSH in Windows allows secure access to remote files without relying on traditional SMB or FTP protocols. This method uses SSHFS-Win, which leverages the SSH File Transfer Protocol (SFTP) to mount remote directories as local drives.
Key Benefits
- Enhanced security by using encrypted SSH connections
- Direct integration with Windows Explorer and command prompt
- Supports both password and SSH key authentication
- Compatible with both Linux and Windows remote hosts
Prerequisites
- Windows system with administrative privileges
- SSH access (username, host, and credentials) to the remote server
- Installation of WinFsp and SSHFS-Win
Installation Steps
Step 1: Install Required Packages
Download and install WinFsp and SSHFS-Win. Alternatively, use the command:
winget install SSHFS-Win.SSHFS-Win
Optionally, install SSHFS-Win Manager for a graphical interface.
Step 2: Map Network Drive Using Windows Explorer
- Open File Explorer, right-click “This PC,” and select “Map network drive…”.
- Choose a drive letter.
- Enter the UNC path using one of the following formats:
\\sshfs\user@host[\path] \\sshfs.r\user@host[\path] // For root directory \\sshfs.k\user@host[\path] // For SSH key authentication \\sshfs.kr\user@host[\path] // For root with SSH key
Example:
\\sshfs.r\[email protected]\ps
Enter your SSH password or use a saved credential.
Step 3: Map Network Drive Using Command Prompt
Use the net use command:
net use W: \\sshfs.r\[email protected]\var\www /user:sysops
For persistent mapping:
net use W: \\sshfs.r\[email protected]\var\www /user:sysops /persistent:yes
To delete a mapped drive:
net use W: /delete
Save credentials for automatic connection:
cmdkey /add:192.168.123.123 /user:admin /pass:YourPassword
SSH key authentication is recommended for improved security.
Step 4: Map Drives Using SSHFS-Win Manager (GUI)
- Launch SSHFS-Win Manager.
- Click “Add Connection” and fill in: Name, IP/Host, Port (default 22), User, Authentication method (password or OpenSSH key), Remote path, and Drive letter.
- Save and connect; the drive appears in Windows Explorer.
Step 5: Automate Drive Mapping at Logon
Create a scheduled task to run a PowerShell script that mounts the drive using SSH key authentication.
Example PowerShell snippet:
$remoteUser = "admin" $remoteHost = "fs01.example.com" $remoteDir = "\Install" $Drive = "M:" $privSSHKey = "C:\secret\fs01-id_rsa" cd 'C:\Program Files\SSHFS-Win\bin\' $mountcmd = ".\sshfs-win.exe svc \sshfs.k\$remoteUser@$remoteHost$remoteDir $Drive -IdentityFile=$privSSHKey" Invoke-Expression $mountcmd
This ensures the network drive is available at each login.
Tips and Best Practices
- Use SSH key authentication for better security and automation.
- Save credentials in Windows Credential Manager to avoid repeated prompts.
- Multiple drives can be mapped simultaneously using different drive letters.
- Use SSHFS-Win Manager for a user-friendly, graphical setup experience.
- Unmount drives easily via Windows Explorer or the net use /delete command.
Troubleshooting
- Ensure the SSH server is accessible and the firewall allows SSH connections.
- Double-check the UNC path format and authentication details.
- For key-based authentication, convert private keys to OpenSSH format if needed.
- If mapping fails, review permissions on the remote server and test SSH connectivity directly.
Mapping a network drive over SSH in Windows with SSHFS-Win provides a secure, flexible, and efficient way to access remote files. Both command-line and graphical methods are available, supporting password and SSH key authentication. Persistent and automated mappings are easily configured for seamless workflow integration.