External Storage with $user ( for Active Directory users)

so sorry, i am new to nextcloud and Thanks for giving this opportunity to share our issue.

i am trying to use windows SMB in nextcloud as primary storage for some users / group. its workign perfectly fine but i am looking to have user name folder to be auto created in external storage path and then all all date should be in their respective folder.
bellow works fine:

however if i user $user option as given in admin document its not working.

not sure where i am wrong.

Nextcloud version (eg, 12.0.2): 17.0.1
Operating system and version (eg, Ubuntu 18.04):
Apache or nginx version (eg, Apache 2.4.25):
PHP version (eg, 7.3:

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): yes

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE
```<?php
$CONFIG = array (
  'instanceid' => 'ocxmftsqft92',
  

  'trusted_domains' =>
  array (
   
  ),
  'htaccess.RewriteBase' => '/',
  
  'dbtype' => 'mysql',
  'version' => '17.0.1.1',

  'dbname' => ',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
 
  'installed' => true,
  'auth.bruteforce.protection.enabled' => true,
  'cron_log' => true,
  'logtimezone' => 'Asia/Kolkata',
  'loglevel' => 1,
  'log_rotate_size' => 104857600,
  'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\XBitmap',
    5 => 'OC\\Preview\\Movie',
    6 => 'OC\\Preview\\PDF',
    7 => 'OC\\Preview\\MP3',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
    10 => 'OC\\Preview\\MSOffice2003',
    11 => 'OC\\Preview\\MSOffice2007',
    12 => 'OC\\Preview\\MSOfficeDoc',
    13 => 'OC\\Preview\\OpenDocument',
    14 => 'OC\\Preview\\PDF',
    15 => 'OC\\Preview\\StarOffice',
  ),
  'skeletondirectory' => '/var/www/nextcloud/core/skeleton',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 3,
    'password' => '',
    'dbindex' => 0,
  ),
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  
  'overwriteprotocol' => 'https',
  
  'knowledgebaseenabled' => false,
  'allow_user_to_change_display_name' => false,
  'maintenance' => false,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
    0 => 'admin',
  ),
  'app_install_overwrite' =>
  array (
    0 => 'beame_insta_ssl',
  ),
  'has_rebuilt_cache' => true,
  'updater.release.channel' => 'stable',
  'theme' => '',
);


The output of your Apache/nginx/system log in `/var/log/____`:

PASTE HERE

have you tried putting $user in the box left, close to the red mark?

Thank you so much for your revert, if i put $user in that box it will consider as folder and my entire purpose will be defeated, more over at user end it will display as $user folder which i dont want

let me share my requirement.

  1. user must access ONLY external storage for their data - i think we have to use “/” in remote sub folder for this.
  2. when AD user login, there should be dedicated folder with name of user logon on external storage share path and this will be home folder for them so that it will be easy to identify which folder belongs to which users.

note- i am pasting content from next cloud admin guide where they says by putting $user my purpose will match but it not working… here are content

appreciate if some help me on this.

we are looking for solution, can anyone please help

Have you red this?
https://docs.nextcloud.com/server/17/admin_manual/configuration_user/user_auth_ldap.html#special-attributes

Look for the User Home Folder Naming Rule.

I put the following value in there: sAMAccountName

And this are my external storeage settings:

Hope this helps :slight_smile:

Thank you so much, but it seems it will change for all user… my requirement is as bellow:

User from Group A, should use storage from same server ( default )
User from Group B, should use SMB which is on windows system.

for Group B users, they must access SMB as root and should not be able to use space from Local drive.
my understanding may be wrong as new person for Netxloud, please guide me.

Just add the group B to the last column “Available for”. If you do not set any value there then it will be used for every user.

HI Stefan,
request for your help, i am i am unable to create Automatic folder similar to sAMAccountName in my External storage, this way it will be easy for all users. if i create manual sAMAccountName folder and map explicit external drive for users then it works, but i have many users and i want to user bellow feature given by Nextcloud, somehow not working.
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.

Hi,

Any luck please. i am again and again being back to sqr as not sure why feel is that, it should work.

Thanks.

Hi Santosh am also facing the same issue here, the only difference is am trying to create user folders on external drive.

So did you solve it??
its been more than a week, i stuck here

1 Like

have you found a solution for this?
Thank you in advance