如何通过 SSH 在 Windows 中挂载远程 Linux 文件夹?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/443732/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 16:52:32  来源:igfitidea点击:

How do I mount a remote Linux folder in Windows through SSH?

linuxshellssh

提问by Jared

I'm a blind student currently in a system admin/shell programming class. Although ssh works fine for executing commands like ls, pwd, etc editors do not work well with my screen reader and an ssh session. I was wondering if it is possible to mount a Linux folder over ssh so it appears as a windows drive? This way I could edit any files I needed to with accessible software and not have to constantly use SCP to send files back and fourth.

我是一名盲人学生,目前正在上系统管理员/shell 编程课程。尽管 ssh 可以很好地执行 ls、pwd 等命令,但编辑器不能很好地与我的屏幕阅读器和 ssh 会话配合使用。我想知道是否可以通过 ssh 挂载 Linux 文件夹,使其显示为 Windows 驱动器?通过这种方式,我可以使用可访问的软件编辑我需要的任何文件,而不必经常使用 SCP 来回发送文件。

采纳答案by Sunny Milenov

Back in 2002, Novell developed some software called NetDrivethat can map a WebDAV, FTP, SFTP, etc. share to a windows drive letter. It is now abandonware, so it's no longer maintained (and not available on the Novell website), but it's free to use. I found quite a few available to download by searching for "netdrive.exe" I actually downloaded a few and compared their md5sums to make sure that I was getting a common (and hopefully safe) version.

早在 2002 年,Novell 就开发了一些名为NetDrive 的软件,可以将 WebDAV、FTP、SFTP 等共享映射到 Windows 驱动器盘符。它现在是废弃软件,因此不再维护(并且在 Novell 网站上不可用),但可以免费使用。我通过搜索“netdrive.exe”找到了很多可供下载的文件,我实际上下载了一些并比较了它们的 md5sum 以确保我得到的是一个通用的(希望是安全的)版本。

Update 10 Nov 2017SFTPNetDriveis the current project from the original netdrive project. And they made it free for personal use:

2017 年 11 月 10 日更新SFTPNetDrive是来自原始 netdrive 项目的当前项目。他们免费供个人使用:

We Made SFTP Net Drive FREE for Personal Use

我们免费提供 SFTP Net Drive 供个人使用

They have paid options as well on the website.

他们在网站上也有付费选项。

回答by Michael Haren

You need to mount a remote share on your windows machine. This is what Samba/smbis for.

您需要在 Windows 机器上安装远程共享。这就是Samba/smb的用途。

What you'll be doing is turning your Linux box into an SMB server, which lets it share files in a way that plays nice with Windows.

您将要做的是将您的 Linux 机器变成一个 SMB 服务器,让它以一种与 Windows 兼容的方式共享文件。

If you're not on the same network, you'll need to tunnel this through your SSH connection which may not be worth the effort.

如果您不在同一个网络上,则需要通过 SSH 连接进行隧道传输,这可能不值得付出努力。

回答by Vinko Vrsalovic

Another, more Windows-y option (for $39) is http://www.expandrive.com/sftpdrive

另一个更像 Windows 的选项(39 美元)是http://www.expandrive.com/sftpdrive

回答by Stefano Driussi

I don't think you can mount a Linux folder as a network drive under windows having only access to ssh. I can suggest you to use WinSCPthat allows you to transfer file through ssh and it's free.

我认为您不能在只能访问 ssh 的 Windows 下将 Linux 文件夹安装为网络驱动器。我可以建议您使用WinSCP,它允许您通过 ssh 传输文件,而且它是免费的。

EDIT: well, sorry. Vinko posted before me and now i've learned a new thing :)

编辑:好吧,对不起。Vinko 在我之前发帖,现在我学到了新东西 :)

回答by matli

Dokanlooks like a FUSE and sshfs implementation for Windows. If it works as expected and advertised, it would do exactly what you are looking for.

Dokan看起来像是 Windows 的 FUSE 和 sshfs 实现。如果它按预期和宣传的那样工作,它将完全符合您的要求。

(Link updated and working 2015-10-15)

(链接更新和工作 2015-10-15)

回答by neesh

Take a look at CIFS (http://www.samba.org/cifs/). It is a virtual file system you can run on your linux machine that will allow you to mount folders on your linux machine in windows using SMB.

看看 CIFS ( http://www.samba.org/cifs/)。它是一个虚拟文件系统,您可以在您的 linux 机器上运行,它允许您使用 SMB 在 windows 中的 linux 机器上安装文件夹。

CIFS on linux information can be found here: http://linux-cifs.samba.org/

关于 linux 的 CIFS 信息可以在这里找到:http: //linux-cifs.samba.org/

回答by Alnitak

Apparently the free NetDrivesoftware from Novell can access SFTP file servers.

显然,Novell的免费NetDrive软件可以访问 SFTP 文件服务器。

回答by Alnitak

check out Dokan

看看多坎

https://dokan-dev.github.io/

https://dokan-dev.github.io/

it's iffy, but it works, and it's free

这是不确定的,但它有效,而且是免费的

回答by Leo

Second David's answer below: I needed to mount a network drive automatically when users logged in. Dokan SSHFS is a nice tool, but wasn't reliable enough in this case. The copy of Netdrive I found didn't support SSHFS or sftp - not sure if a more recent one does.

第二个大卫的回答如下:我需要在用户登录时自动挂载网络驱动器。Dokan SSHFS 是一个不错的工具,但在这种情况下不够可靠。我发现的 Netdrive 副本不支持 SSHFS 或 sftp - 不确定更新的是否支持。

The solution I'm trialling now involves adding a virtual network adapter (with file sharing disabled), using plink to open a tunnel via the new adapter to the remote machine running SAMBA, and mounting the network drive against the new adapter. There's another useful tutorial here http://www.blisstonia.com/eolson/notes/smboverssh.php.

我现在正在试用的解决方案包括添加一个虚拟网络适配器(禁用文件共享),使用 plink 通过新适配器打开一个隧道到运行 SAMBA 的远程机器,并在新适配器上安装网络驱动器。这里还有另一个有用的教程http://www.blisstonia.com/eolson/notes/smboverssh.php

The tunnel and network drive can be set up with a login script, so a few seconds after login users can use the mapped drive without needing to take any action.

隧道和网络驱动器可以使用登录脚本设置,因此登录后几秒钟用户就可以使用映射的驱动器而无需采取任何操作。

回答by Daniel Sokolowski

The best an easiest solution I found is https://github.com/billziss-gh/sshfs-win, connected servers shows up as a fully functioning network drives. This is not a 'Dokany' or 'dokan' based solution which from experiance seems more stable and performant, also see WinFsp Performance Testing.

我找到的最好的最简单的解决方案是https://github.com/billziss-gh/sshfs-win,连接的服务器显示为功能齐全的网络驱动器。这不是基于 'Dokany' 或 'dokan' 的解决方案,从经验来看,它似乎更稳定和性能更高,另请参阅WinFsp 性能测试

mount ssh on windows

在 Windows 上挂载 ssh

Please note previously this answer stated, https://github.com/Foreveryone-cz/win-sshfsand before that http://www.swish-sftp.org/but I no longer use any of them, first one stopped working second one created drives not fully supported in all programs.

请注意之前这个答案,https://github.com/Foreveryone-cz/win-sshfs和之前的http://www.swish-sftp.org/但我不再使用它们中的任何一个,第一个停止工作第二个创建的驱动器并非所有程序都完全支持。