How to move/default all users to an external windows server share that I've created

First off I am new here to this forum :slight_smile: Take it easy on me LOL
I have up and running Nextcloud 23.02 on Ubuntu Linux 20.04.3. I’m also not a seasoned Linux pro.
I’ve created a SMB windows server share on Nextcloud that seems to have gotten created successfully. Now I would like to disable local storage if possible and link all AD users to the external storage under their own name so other users won’t or can’t access each others files. Is this even possible? If anything is needed from me just let me know and I will get the info needed.

I did find others talking about this but couldn’t get it done…

Much appreciated!

well I can’t think of any way that could work in the described way. But what you can do is this: Nextcloud allows you to move the datadirectory (the folder containing all users data) from the default localtion /var/www/nextcloud to any other localtion that is in range of your linux system. What you can do is as follows:

mount the external smb drive in your linux system, for this read some documentation on the mount operator of linux.
Copy the datafolder to the mounted location.
Change the datalocation in your NC config file.

This won’t link a user to an on external storage but it won’t dump your local storage.

Thank you so much! I will give your suggestions a try. I do have it all up and configured to work from outside the network. Now it’s time to dig in with your suggestions.

Thank you!

Hi @Tony414 and @DrJambus
I think the idea from @DrJambus is not really good. I think it is not possible to use SMB/CIFS for primary storage (what about e.g. trash). But i have never tested it. Sorry.

But you can set the quota of the user to 0 B. Hopefully he/she can use the SMB share. :wink:
Test it with one user. Perhaps you like this setting.

Also maybe you can give each user 1GB if you have some space on your nextcloud. External memory sometimes causes trouble. remember to enable sharing somewhere in the settings if you need it.

Yea I’m having a little difficulty trying what @DrJambus suggested. I do have the external storage in Nextcloud configured and it does show up when I test it from my phone app. So maybe if I do what @devnull said and set the quota to 0 it should work. But will the end user need to know this or will it default to the external storage? Maybe I just need to tell them?


@devnull Is there a simple way to set all users quote to 0? Thank you

I think you can use occ. You can write a small shell script and execute:

sudo -u www-data php occ user:setting username files quota 0GB

Not tested.

for i in $(cat list.txt);do sudo -u www-data php occ user:setting $i files quota 0GB;done

Also not tested. :wink:

Thank you again! I actually ended up finding it in the Nextcloud gui here :slight_smile:


Yes. Perhaps you can also set the default quota to 0B. But i have never tested it. But I would imagine that this only applies to new users and not to current users.

It actually did apply it to all users. I’m only doing this in a test lab so I’m just playing around at this point :slight_smile:

Do you know if the external storage is all lumped together for everyone to see or will it create each user separately? I wish there was a way to keep each user separate. Sorry for all these questions. Very new with this…

i woulrd expect to find a seperate folder for each user on the share written by and read by the user wich handles the external storage connection.

@DrJambus I tested this out with another user. It does not seem to create a users “own” folder but rather drops both my files and theirs in the same “nextcloud” folder I setup on my external storage. Unless there is some sort of setting I am missing. It drops all files in this external storage location for all users.

Hi, I guess the approach would be to assign a minimum - or 0 ‘internal’ storage space, to each user and create an external storage for each. This will end up in a new folder which is referring to the external storage within each users work environment.
Related to specific external storage for each user, I got this running simply with an external HD and using $user in the path of the external storage incl. creating locally on the external HD a specific folder for each nominated user. With SMB/CIFS -there exists a separate request, which currently is not yet solved and working. See External storage Configure users to have access to their home drives

@charlacher Thank you so much for the reply. If I’m understanding you correctly, are you say that I would need to create these users in my external storage first? I have way to many users that would be using NC and that would take me a long time. I can see that you mentioned using $user in the path. Would that auto create their directory? Sorry but I’m a little slow with all this because I’m not a seasoned pro with Linux and NC is all new to me. I was successful in setting the quota to 0.


@Tony414 Yes, at least that’s how I got it running. So you need to create within the destination server - for each user a dedicated folder (named as the user). You can than simplify within ‘External Folder’ settings using $user - that there is no need to add each specific user folder within ‘External Folder’ settings, but just add once the main path/$User. Be aware that you have to add each user on the right menu to this path to grant access.
See the previously mentioned and linked issue - there is an example of the path within settings and how it looks like in the destination directory.
Sorry I am not a power user of this method, just tried it and got it running like that.