External Storage- Automatic Folder for LDAP user


i am using Latest Netxcloud.

this is my second post where i am looking for help. my requirement is , when LDAP user login, there should be automatic folder created with the name of login ID on External storage and it should not be visible to other users, means all respective user should see only her / her folder.

i am able to achieve this when i create manual user in External user similar to AD login ID, but problem is , i have many user and manual work will be difficult.

is there any way i can do this for certain group of users.

i am using Windows Share for External storage.


i did it little bit different .
i use my organisation ms LDAP to authenticate users on nextcloud
all my domain users have home mapping on AD, only the user can see this folder.
i created inside the user home sub directory called NextCloud.

on next cloud i use sAMAccountName for users naming instead of the default NC UUID.
to achieve this you need to go to settings -> LDAP-> advanced-> special attributes -> User Home Folder Naming Rule , type there : sAMAccountName .
“$home” Placeholder Field: sAMAccountName.
new users will have NC folder name same as the sAMAccountName from AD.
if you don’t have live\production users you can go to expert and clear username-ldap mapping .

in external storage i choose:
authentication: log-in cred, save in session
configuration: server name , my top share , path to subdirectory (in my case is: users/$user/MyCloud ) , mydomain.
Available for: i created group in AD for NC users (only this users can login)

1 Like

Thanks for your revert, however i am failing and its not working.


in my case, i dont see Ldap name based folder in share folder when user login, example if LDAP user login ID is user.name then with the same name there should be folder and similarly for others user and no one should see others folder.

am i missing something.

if the group is new to NC then go to LDAP / AD integration and click verify settings and count users.

BTW why is it showing / where it is need to be SMB ? is smbclient php-smbclient installed in your box ?

Thank you, if i use / then all users will directed to that external storage, this what i got to know from one of Nextcloud forum.

can you please share screenshot of your external folder and special attribute in LDAP config.

so sorry for those info, i am struggling badly.

delete the /

Thank you so much no luck. user id test.user is able to login but i dont see folder name test.user under users folder.

here is my SMB server details.

not sure what i
m missing

what i suggested is to mount a windows smb share into the user space in nextcloud .
the folders are already there and i just mounting them.

if i understood you right you need a script that will monitor users table in db or monitor /netxtcloud/data folder for changes and then to trigger an mkdir $user to the remote share

or maybe what you trying to get is mounting the smb to your linux machine and move nextcloud date folder to there ? in this case all user folders will be created automatically

Thanks for your detail help. how did you Achieve ?

my setup is, Nextcloud running on Ubuntu, with Apache.
i have Windows Active Directory and Windows File Server which is going to work as External storage.
i have only Problem, AD user name ( fisrtname.lastname ) folder is not creating automatically in External storage sub folder , if i create manually firstname.lastname, it works Perfectly fine but again i have to map individual External storage entry for all individual users which will be very heavy work.
i need only way to auto create folder under share folder once user is login.
i was going thru this Article : https://docs.nextcloud.com/server/18/admin_manual/configuration_files/external_storage/smb.html

where they have explained to achieve my requirement, but somehow its not saving and not working. please see bellow screen.

Dear All,
Any help on my above request, i am stuck on this.


as i wrote earlier , when a new user log in , NC will create the user home folder in /nextcloud/data folder.
now you have 3 options

1st is to create additional folder on the windows server and let NC mount it for each user as external folder , the user will have his home directory on /nextcloud/data + external SMB folder

2nd is to write a script to monitor new user in DB or monitor for new folder in /nextcloud/data
and creating the new remote folder on the SMB windows share

3rd is to mount the smb share as external storage for the server , the server will see it as local drive , and then move the /nextcloud/data folder and setting to the SMB share , and when a new user is log in , his home folder will be created in /nextcloud/data (smb share)

Thank you so much, and so sorry i m not too good with nextcloud, recently started using. what about my existing users data.

if i go with option one, what i have to do.

let me Explain you what i have.

my default Nextcloud\Data directory is in Same Local server, and Existing Users Data is there, now i want to create External storage for Laptop Users and Assign that place for them and also not allow them to user Nextcloud\Data directory.

any suggestion please.

you want to split the data folder to 2 locations based on group membership , i don’t think NC have this kind of feature.

Ohh . any suggestion why $user is not workigng in my case, i am applying all suggested parameter.

why i am seeking your input because its workign in your case.


the difference is that im not expecting NC to create another folder for me beside the first home folder in hid data directory.
on my system $user = sAMAccountName
on standart NC install $user = NC_UUID

it seems i have to do all manual, in my below screenshot, i have created folder name test.test on External storage and this way, when user will login, he or she can only see their respective folder on external storage .
this works fine but i need to this for all Laptop Users, unfortunately failing to automate this.

Hi am facing the same issue, did u manage to solve it??