{"id":10827,"date":"2025-05-13T15:00:55","date_gmt":"2025-05-13T15:00:55","guid":{"rendered":"https:\/\/cheapwindowsvps.com\/blog\/how-to-map-a-network-drive-over-ssh-sshfs-in-windows-a-step-by-step-guide\/"},"modified":"2025-05-13T15:00:55","modified_gmt":"2025-05-13T15:00:55","slug":"how-to-map-a-network-drive-over-ssh-sshfs-in-windows-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/cheapwindowsvps.com\/blog\/how-to-map-a-network-drive-over-ssh-sshfs-in-windows-a-step-by-step-guide\/","title":{"rendered":"How to Map a Network Drive Over SSH (SSHFS) in Windows: A Step-by-Step Guide"},"content":{"rendered":"<p>To mount a remote server&#8217;s file system as a network drive in Windows, using the secure SSH protocol is an efficient alternative to traditional SMB connections. This method allows secure access to files on a remote SSH server without needing to create a separate FTP (SFTP) connection. The <strong>SSHFS-Win<\/strong> client facilitates the process of mounting remote file systems via SSH.<\/p>\n<p>You can obtain the SSHFS-Win MSI installer manually or through the built-in WinGet package manager with the following command:<\/p>\n<pre><code>winget install SSHFS-Win.SSHFS-Win<\/code><\/pre>\n<p>Once installed, you can map a remote folder as a network drive using Windows File Explorer. Right-click on <strong>This PC<\/strong> and select <strong>Map Network Drive<\/strong>. Assign a drive letter and set the UNC path to the remote directory in this format:<\/p>\n<pre><code>\\prefix\\user@host[!PORT][\\PATH]<\/code><\/pre>\n<p>Where:<\/p>\n<ul>\n<li><code>user<\/code> is the account used for SSH authentication<\/li>\n<li><code>host<\/code> refers to the hostname or IP address of the remote server<\/li>\n<\/ul>\n<p>You can use the following prefixes:<\/p>\n<ul>\n<li><code>sshfs<\/code> to map the user&#8217;s home directory<\/li>\n<li><code>sshfs.r<\/code> to mount the root directory of the remote computer<\/li>\n<li><code>sshfs.k<\/code> to map the user&#8217;s home directory using an SSH key<\/li>\n<li><code>sshfs.kr<\/code> to connect to the root directory with an SSH key<\/li>\n<\/ul>\n<p>For instance, to mount the <code>C:PS<\/code> directory from a remote Windows host with the SSH server enabled, the command would be:<\/p>\n<pre><code>\\sshfs.r&lt;user&gt;@&lt;host&gt;ps<\/code><\/pre>\n<p>On connecting, you&#8217;ll need to enter the password for the remote user. You have the option to save the password in Windows Credential Manager for future logins.<\/p>\n<p>Alternatively, you can map a network drive from the command prompt using the <code>net use<\/code> command. To mount the <code>\/var\/www<\/code> directory from a Linux host, use:<\/p>\n<pre><code>net use W: \\sshfs.r&lt;user&gt;@&lt;host&gt;varwww \/user:sysops<\/code><\/pre>\n<p>This command will prompt for the user&#8217;s password each time. To persist the mapping across reboots, add the <code>\/persistent:yes<\/code> option.<\/p>\n<p>To avoid entering the password each time, you can store the credentials using:<\/p>\n<pre><code>cmdkey \/add:&lt;host&gt; \/user:&lt;user&gt; \/pass:&lt;password&gt;<\/code><\/pre>\n<p>Multiple network drives can be connected simultaneously using the WinFsp.Np provider. To view connected drives, run:<\/p>\n<pre><code>net use<\/code><\/pre>\n<p>To delete a mapped network drive, use:<\/p>\n<pre><code>net use M: \/delete<\/code><\/pre>\n<p>While it is possible to include the user&#8217;s password in plain text in the <code>net use<\/code> command, it is more secure to utilize SSH key authentication. To set this up, generate SSH keys on Windows and copy the public key to the <code>authorized_keys<\/code> file on the remote SSH server.<\/p>\n<p>You can also automate the mapping of a network drive over SSH at Windows logon by creating a scheduled task that runs a PowerShell script. Here&#8217;s an example script:<\/p>\n<pre><code class=\"language-powershell\">$remoteUser = &quot;admin&quot;$remoteHost = &quot;fs01.woshub.com&quot;$remoteDir = &quot;Install&quot;$Drive = &quot;M:&quot;$privSSHKey = &quot;C:secretfs01-id_rsa&quot;cd 'C:Program FilesSSHFS-Winbin'$mountcmd = &quot;.sshfs-win.exe svc sshfs.k$remoteUser@$remoteHost$remoteDir $Drive -IdentityFile=$privSSHKey&quot;Invoke-Expression $mountcmd<\/code><\/pre>\n<p>For a more user-friendly experience, you can utilize graphical client tools like <strong>SSHFS-Win-Manager<\/strong>, which supports both password and key-based authentication for mapping remote directories.<\/p>\n<h3>Useful Links<\/h3>\n<ul>\n<li><a target=\"_blank\" rel=\"nofollow noopener\" href=\"https:\/\/woshub.com\/installing-sftp-ssh-ftp-server-on-windows-server-2012-r2\/\">SSH File Transfer Protocol (SFTP)<\/a><\/li>\n<li><a target=\"_blank\" rel=\"nofollow noopener\" href=\"https:\/\/woshub.com\/using-winget-package-manager-windows\/\">WinGet Package Manager<\/a><\/li>\n<li><a target=\"_blank\" rel=\"nofollow noopener\" href=\"https:\/\/woshub.com\/using-ssh-key-based-authentication-on-windows\/\">SSH Key Authentication<\/a><\/li>\n<li><a target=\"_blank\" rel=\"nofollow noopener\" href=\"https:\/\/woshub.com\/run-powershell-script-task-scheduler\/\">Scheduled Tasks in PowerShell<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>To mount a remote server&#8217;s file system as a network drive in Windows, using the secure SSH protocol is an efficient alternative to traditional SMB connections. This method allows secure access to files on a remote SSH server without needing to create a separate FTP (SFTP) connection. The SSHFS-Win client facilitates the process of mounting [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":10828,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[99],"tags":[],"class_list":["post-10827","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-11"],"_links":{"self":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/10827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/comments?post=10827"}],"version-history":[{"count":0,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/10827\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/media\/10828"}],"wp:attachment":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/media?parent=10827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/categories?post=10827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/tags?post=10827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}