How do I mount a NextCloud server drive using SFTP, as a virtual drive on Windows?

Hi, I just finished installing NextCloud 13 on a fresh install of Ubuntu 18.04.

Here is how I have been planning on using it:

–=Documents folder on Laptop and Desktop Server synced with Nextcloud allowing me to also link people documents etc from the the NextCloud web interface.

–= Work folder on Laptop and Desktop Server synced with the NextCloud allowing me to also also link clients documents from the NextCloud Web Interface.

–=Archive and Media Server which is on my Desktop Server, and then made available as a mounted drive on the Laptop using SFTP, and also synced into NextCloud so that I could hypothetically watch or stream media to my phone or to the laptop or if I wanted to send a send a friend a video I could create a share link to send them.

I’ve got the first two things working just fine, but in the process I realized that SFTP requires server information. Do I have to create a second server or something? Or can I map stuff directly into the NextCloud Server? How would I get that information?

This is the info that I’m being asked for.

I’m actually intending to use SFTP Net Drive instead of ExpandDrive but the picture they had was in my tab and was a bit easier to read.

I vaguely remember reading about how people use the external storage app for something to do with SFTP but reading through the documentation I’m not clear on if that’s what I need or not. I don’t need to map an external drive over SFTP to my Desktop NextCloud server, I need to connect my Windows Laptop to the Archive and Media Server Drives via SFTP so that I can access the files without having to take up my limited Laptop SSD physical drive space, but at the same time I also still want to be able to access files from the web using NextCloud, even if that’s not how I’m specifically syncing them etc.

Any suggestions? Is the external storage what I need or no? Do I need to spin up a second server and then connect that to my Windows machine while also having those files made available online through the web interface through NextCloud?

The first one seems elegant, and the second sounds pretty messy.

Mount your SFTP server into Nextcloud as an external storage in the settings. It works very well, you can access/share/use it like any local folder in your Nextcloud.

Cool, that’s what I was thinking. I’m trying to do that, but when I click the external storages side bar, even logged in as admin, I get a message that says " no external storage configured or you don’t have the permission to configure them". I don’t see anywhere in the settings to configure the external storage, this is the only place I see the external storage liisted. I’m going to keep looking etc, but if anyone can give me a hint of where I go to configure, or if there is perhaps some bug with my permissions, please let me know.

nvm. found it! I missed it on the setting page.

Okay so I found it, but the SFTP mounting process in Nextcloud is for mounting a server TO my next cloudserver via SFTP.

I’m not sure if I’m making the physical layout or distribution of memory clear or perhaps I’m misunderstanding things.

I have a desktop with

  • 500gb of HDD space
  • 3TB of Raid 1 HDD space

I have a laptop with
-500 of SSD space.

I want to use NextCloud to back up everything on the 500 laptop SSD to the 500gb desktop HDD, and I want the 3TBs to be available to share or link and access from NextCloud but not synced to the 500gb laptop SSD, but instead made available as a mounted SFTP network drive on the laptop.

I do see in the external storages settings a thing for mounting local storage. And I see a thing that says “location”. I assume that is where I should put something like /dev/md0 right? Would that be enough?

And then with that mounted, I would mount the archive desktop 3TB drives via sftp … how? Sorry, I’m just not clear where I would get the SFTP server information. I know where to get the webdav stuff. That’s super easy. But I was told that SFTP is much faster and more reliable espc for big files.

Okay I’m starting to wrap my head around things. I have another question about an error I’m encountering but I’m going to create a second topic focused on that since I believe it’s unrelated, and it would be better for people searching the forums if I keep topics to a single subject.

Okay, as I am not sure how far you are in understanding the storage environment and setting it up, let’s start from the beginning.

The Nextcloud (internal) data folder is just for Nextcloud internal access, via web UI, Nextcloud clients or its internal webdav back-end. If you add/edit files inside there directly or via other file transfer protocols, NFS, SMB (samba), FTP or SFTP, Nextcloud cannot track those changes or indexes these files and thus will not show them. There are ways to manually force that via occ command, but you don’t want to do that always.

For that reason Nextcloud has external (outside of nextcloud data directory, not necessarily outside of the server machine) storage modules that allow Nextcloud to access those, in your case the SFTP directory via SFTP server info. Thus you need to setup an SFTP server (e.g. via OpenSSH included SFTP module), pointing to best a subdirectory on the 3GB drive. Within Nextcloud SFTP extension you then need to provide the related server information/credentials.
This allows you indeed faster access/backup of large files from e.g. your laptop, but on the other hand access from within Nextcloud will be slower, AFAIK, as Nextcloud will always rescan external storages for changes. So it really depends how your priorities are, if you just want to backup and access those files fast via network drives, or you want the have them fast accessible via Nextcloud sharing.

Okay excellent, yes, That makes sense. So I do need to set up an SSH server etc, that makes sense.

Also I was talking to someone else and the requested a diagram so just in case I’ll also post that here:

I’ll do some research on how to get an OpenSSH servert up with an SFTP module etc.

If anybody has any suggestions on the easiest way to do that, let me know :slight_smile:

Also have started the process of syncing my Doc Folders between my desktop server and my laptop. And I’m not entirely sure if I’m going about the process right. There’s some funky things going on.

So on my Windows laptop I have downloaded the NextCloud Client, and I told it to selectively sync folders I tell it to. The only folders I have told it to sync from my Windows laptop are the Documents folder in the Home directory. I have my NextCloud client logged in to an account called “david” which is separated from my admin account for maximum security.

On my server, I have mounted my Documents, Music, Videos folders from my linux $Home folder, and given permissions for my laptop user, david, to have access to them.

My laptop user, david, can see these folders in the web view, but when I open the nextcloud client on the laptop I can only see the local Documents folder syncing.

When I check the contents of the Documents folder in Windows Explorer on my Windows laptop it looks like it’s syncing with the Documents folder on my Desktop, which is what I want. BUT,

I have made other files available to the david laptop user’s account BUT I don’t see the option to pull them down and put them on my laptop machine. I also mounted Archive, Media, and Work from my desktop $home folder through the NextCloud External Storage application, but I don’t see how to use that with the nextcloud client. Does the nextcloud client only allow you to select local folders to be synced, and it doesn’t allow you to pull down new folders that are added?

may it’s easier to setup samba on the (blue) ubuntu desktop and connect the (blue) archive folder as a net share.

so the (green) sftp protocol will be replaced with smb/cifs.

Cool. I’ll look into that.

Someone on reddit told me that I should just stick with webdav because it’s simpler. Are there any articles quantifying the performance difference between the two?

Using WebDAV would be super easy and convenient for your end-users. Very similar to Google Stream Drive For GAPPS users.

A lot would depend on how well our WebDAV stack implementation is with NextCloud.

The last time I used it was several years ago with ‘ownCloud’ before Nextcloud existed.

Anyone have experience with how well the WebDAV protocol works with Nextcloud.?

BJ

I use webdav to access my nextcloudpi server running on a raspberry pi 2b, so i can not really judge performance wise, but it behaves similar to samba, with the difference that the files get synced to nextcloud database when samba needs external files scan to do this. So my suggestion would be definitely to use webdav preferedly over samba, i dont know how sftp would be, but i guess it has the same shortcomings as it would be a seperate server.

+1. this is something which is often misunderstood. nextcloud is not a “web front end for your filesystem”. it’s a cloud portal that keeps metadata for the files that are kept inside it. you should ensure that all files are processed through nextcloud, either via a sync agent on a computer, via the web portal (file upload/download) or webdav. you shouldn’t be updating files on the backend directly and expecting everything to work cleanly.

while you can use the external files scan, you can cause issues when attributes are applied to files in nextcloud. take for example a share link for a folder or a file. if you rename the file or folder in the back end, it would make sense that the share link would break as the operation wasn’t performed through nextcloud.

webdav is a great solution. make sure you use SSL and have a valid SSL certificate (ie: LetsEncrypt or a provider purchased certificate) and not a self-signed certificate. I can’t speak for other platforms, but I know that webdav support to map a drive in windows won’t work unless it’s SSL and a certificate that validates correctly. (while you could use a private CA and distribute the CA ROOT certificate manually, it’s hardly worth it when LetsEncrypt is free and even CA purchased certificates are now dirt cheap. You only need a DV [domain validation] certificate)

the webdav link for each user is displayed in the bottom left hand corner of the nextcloud portal.

i hope the rest of your implementation goes well. everyone enjoys reading success stories and implementation experiences.

cheers, wizdude.

Sorry, I’m a bit new to this stuff, but are you saying that I shouldn’t be directly manipulating my files in the file explorer? That I should only be using an accessing my files in the NextCloud folders?

what i’m saying is that your interaction with nextcloud should either be through the web portal, via a desktop file sync agent or webdav. you shouldn’t be interacting with the backend filesystem directly.

for files that are synced to your local machine via a desktop sync agent, you can happily use file explorer on these as that is exactly how you are meant to use nextcloud. when you add/remove/change files they are sync’d back via the sync agent into nextcloud.

i would avoid solutions (SFTP, SAMBA, etc) that permit you to bypass nextcloud and access the files in the back end directly as you’ll need to use the external files scan to pick up the changes. the exception would be if anyone developed an SFTP or similar plugin for nextcloud, but nothing like this currently exists.

Okay so I can use the file explorer on my windows laptop which is synced by the desktop sync agent, but can I also directly manipulate files on my desktop Linux machine that is hosting the files? I have my Documents and Media folders in the Home folder mounted as external folders to Nextcloud through the external folders app.

So far that seems to be fine but I am also running into these problems and I can figure out how to fix it. Why will these files not sync?

I’m worried that I’ve been using it incorrectly and that’s why I’m encountering this problem with the client.

I might have figured out my problem. It seems the .vscode folder for some reason had made itself write protected on the windows machine. I’m changing that now and hopefully that will clear up the last little bits of incorrect syncing issues I’ve been having. Then I’ll get around to mounting the big archive folder through web dav.

It’s taking awhile for the permissions to change on the vscode folders so I decided to try and connect the archive folders via webdav and I keep on getting an error message saying that it can’t be found.

According to my nextcloud web portal my webdav url should be: https://cloud.jackalope.tech/remote.php/webdav/

[redacted guest login after confirming it works]

I’m going to keep fiddling with this too.

Wellll… Now nextcloud simply won’t connect at all. The client on my laptop can’t connect. When I go to cloud.jackalope.tech I can’t connect, and when I try to go to my IP address, it tells me that I can’t connect because the cert is for cloud.jackalop.tech. If I then add an exception it takes me to this page:

Then when I checked back to that window after writing up most of this message it had a login , but logging into my non admin account gave me a thing saying I was locked out and needed to be admin. I’m going to try and log in as admin. But it’s acting weird.

I just installed an Ubuntu security update. Could this have done something to misalign my settings or something?

i’ve just connected from a windows 10 pc and it appears to be working fine. i’m doing a test copy of a music folder which i’ll then upload again into a test folder.

i mapped from my windows 10 pc using:

net use q: \\cloud.jackalope.tech@ssl\remote.php\webdav

and provided the credentials when prompted.

update: i’ve just finished the file copy test. no errors, albeit a bit slow, but then again i’m located over 250ms away :slight_smile:

you’ll see a folder called “test2” where i copied a random music folder into.