The Basics
-
Nextcloud Server version (e.g., 29.x.x):
-
Operating system and version (e.g., Ubuntu 24.04):
-
Web server and version (e.g, Apache 2.4.25):
-
Reverse proxy and version _(e.g. nginx 1.27.2)
PHP version (e.g, 8.3):
-
Is this the first time you’ve seen this error? (Yes / No):
-
When did this problem seem to first start?
-
Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
-
Are you using CloudfIare, mod_security, or similar? (Yes / No)
Summary of the issue you are facing:
Hello,
Can someone help with configuring external storage SMB. I am not able to configure it with $user option so folders are created automatically for each active directory user. Only option that is working is with slash / option but that is not what i want.
Active directory sync is working with samaccountname in expert tab configured
If anyone can help i would appreciate it]
If $user works in the external storage configuration, Nextcloud should substitute it with the logged-in Nextcloud username. Since your AD sync uses samaccountname, I would first verify that the Nextcloud username is actually the same value.
For example, if AD sync creates the user as john.smith, the SMB path would typically need to resolve to something like:
/share/john.smith
rather than expecting the SMB server to interpret $user itself.
Also check the External storage → SMB/CIFS configuration and make sure the option for using the logged-in user’s credentials is configured as intended. A useful test is to temporarily use a fixed path with the same credentials; if that works, the problem is likely the variable/username mapping rather than SMB connectivity.
If you can post the exact SMB configuration fields you’re using (without passwords), it would be easier to see where $user is being interpreted incorrectly.
Thank you for your reply. I think that found solution with changing file
/var/www/nextcloud/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php
This line:
$storage->setBackendOption(‘user’, $user->getUID());
Now everything is working but i need to make folders manually. Can i make script to make user folders automatically when they log in?