4

Is it possible to map as a network drive, a server that I SFTP to?

For example FileZilla or WinSCP(which supports SFTP) can let you browse around a server that you SFTP to. But i'd like to map a drive letter to it.

(Many good answers have been posted, and got the question well. But incase there is a person in comment that didn't understand the question and thought SAMBA was the answer, and wants to know why, and want more clarity in the question. So, some more info re that. I am not looking at simply over a LAN, or even over a LAN. If I was then i'd use windows file sharing, or equivalents where other OSs are involved. To really simplify things, any answer has to be SFTP specific. The advantage with SFTP, and the reason people tend to use it, is it is part of SSH and SSH is built to be good/secure for access across the Internet. So an answer should involve SFTP. If somebody wants to suggest some alternative to SFTP then that could be done as a comment, but SAMBA, which is a file sharing protocol intended only over LANs, and is what user @pbies tried to write an answer saying, is not an answer or an alternative.).

0

4 Answers 4

4

In Linux we use sshfs (a FUSE-based) for it. There is a Windows port, try it: https://github.com/winfsp/sshfs-win . It's FOSS, in contrast to that ExpanDrive.

0
4

I found Rclone to be the best way to do this:

Download it from https://rclone.org/downloads/

Get the mounting prerequisite package from http://www.secfs.net/winfsp/ (Win File System Proxy)

Run through the config wizard, details from https://rclone.org/sftp , via the windows cmdline

rclone config

Here is a simple working example of a config file:

[remote]
type = sftp
host = ahost.com
user = auser
pass = thepassword
shell_type = unix
md5sum_command = md5sum
sha1sum_command = sha1sum

Use it's mount functionality as detailed in https://rclone.org/commands/rclone_mount/

Run the mount command through windows cmdline (D drive being your mapped drive in this example):

rclone mount remote:/srv/data/ d:\

If you are using it with download management software and you get access errors its best to add this in to allow simultaneous read/write/update file operations:

rclone mount --vfs-cache-mode writes remote:/srv/data/ d:\
0

I figured some users of WinSCP might request it 'cos WinSCP is a very good program, they clearly added an SFTP feature and I figured some users of it might ask for a mapping network drive feature.

I came across the following from the WinSCP website.
Can I map a remote directory as a network drive in Windows?

WinSCP does not allow this. Neither there are plans to add the functionality in near feature due to lack of experience in the field. However, some commercial programs such as ExpanDrive can do this.

With some limitation you can use function Keep remote directory up to date as a replacement.

Taking a look at the program they suggest, Expandrive, it works.

It looks extremely versatile being able to connect to all these things

enter image description here

And one of the things it mentions is SSH(SFTP) (SFTP is part of SSH / works through SSH).

And it certainly works , here is my VPS.. my virtual machine, digital ocean droplet!

enter image description here

-2

You didn't said that this server is only SFTP-accessible, so other way around is to install and configure Samba on server and then map network drive to Samba share - from Windows to Linux.

If the server is accessible through the Internet, not locally - VPN would be a nice security feature for Samba connections.

5
  • well if it were a windows machine then by your "reading" of the question you could have said use windows file sharing. I think Windows File Sharing , and so I suppose SAMBA too, aren't really meant to be used over the internet..So they are far more limited than SFTP, And SFTP is part of SSH, so has all the security of SSH in there.. Windows file sharing or SAMBA are not alternatives to SFTP. They're meant just for your LAN. When on a LAN then one would probably use Windows File Sharing / SAMBA. (over SFTP). A somewhat alternative is a VPN(though still quite different).
    – barlop
    Commented Jan 9, 2023 at 16:33
  • @barlop where do you see word "Internet" in the question?
    – pbies
    Commented Jan 9, 2023 at 16:35
  • Well, then why are you even mentioning SAMBA and linux. You could just say "Use windows file sharing" Also, the use of SFTP over a LAN would be very odd(and maybe very hard to justify too),. yet you assume that it's over a LAN. Your "alternative" is really not an SFTP alternative, it's a tool for a different application. SFTP has broader usage. You're ignoring the main and almost sole use of SFTP.
    – barlop
    Commented Jan 9, 2023 at 17:27
  • @barlop I am mentioning, as this seems to be local network, not the Internet.
    – pbies
    Commented Jan 9, 2023 at 18:53
  • No, there is nothing in the question that should make it "seem" to be particular to a LAN.. On the contrary. SFTP tends to not be used much when it's just over a LAN.
    – barlop
    Commented Jan 10, 2023 at 21:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .