How to prevent nextcloud from automatically creating a templates folder?

Nextcloud version (eg, 20.0.5): 21.0.1
Operating system and version (eg, Ubuntu 20.04): Debian 10
Apache or nginx version (eg, Apache 2.4.25): nginx/1.14.2
PHP version (eg, 7.4): 7.3.27

The issue you are facing: Creating a new user automatically creates an Templates folder. I do not wish for this to happen and have even set the templatedirectory to NULL in config.php, but to no avail. Any help would be appreciated!

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

The output of your Nextcloud log in Admin > Logging:

not relevant

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

$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => '***',
    1 => '***',
  ),
  'default_phone_region' => 'DE',
  'datadirectory' => '/srv/www/data',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => 'https://***',
  'dbname' => '***',
  'dbhost' => '***',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '***',
  'dbpassword' => '***',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'app_install_overwrite' => 
  array (
    0 => 'onlyoffice',
    1 => 'whiteboard',
    2 => 'apporder',
  ),
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 0.0,
    'password' => '',
  ),
  'skeletondirectory' => '/srv/www/skeleton',
  'templatedirectory' => NULL,
  'default_language' => 'de_DE',
  'default_locale' => 'de_DE',
);

I am having the same issue, and have pretty much the same setup. I have searched around and don’t really see any information about this. The documentation for templatedirectory says

The directory where the template files are located. These files will be copied to the template directory of new users. Leave empty to not copy any template files.
If this is not set creating a template directory will only happen if no custom skeletondirectory is defined, otherwise the shipped templates will be used to create a template directory for the user.

That does not seem to work though. I have tried several variations without any luck. Did you ever figure out how to keep the Template directory from being created? Does anyone else have any information that may help?

Thanks

Hi @jonbulica99 and @sportsman87620

Try the following:

Change

'skeletondirectory' => '/srv/www/skeleton',

to

'skeletondirectory' => '',

…and delete the line for the template directory!

Then the Files app should be completely empty when a user logs in for the first time.

Is there any new information on this topic?
I installed nextcloud on version 24.0.1.1 - still having the same problem.

Lines from config.php:

  'skeletondirectory' => '/var/www/xx/xx/xx/custom/skeleton',
  'templatedirectory' => ' ',

Although I use a custom skeleton folder and leave the templatedirectory paramter empty the Template folder is still created with no contents.

So, the question is:
How is it possible to use a custom skeleton folder (with custom files in it) WITHOUT a template folder being created for new users?

Hi,

How is it possible to use a custom skeleton folder (with custom files in it) WITHOUT a template folder being created for new users?

Did you find a solution to this ?

So, is there really no way to disable this?

Not by my reading of the manual. It looks like there was an attempt by a community member to submit a PR, but I think it died out or got lost:

Might be worth creating a new Issue (Enhancement request) on the matter and encouraging others that want it to give it a :+1: on GitHub so it’s clear whether there is interest or not for development prioritization.

For information, the last github issue is here: Possibility to disable "Templates" directory creation in the config file · Issue #39266 · nextcloud/server · GitHub
And I would also like to see this fixed…

Execute the following line of code from an ssh console:

rm -R /var/www/nextcloud/core/skeleton/Templates

This will completely remove the templates folder for all NEW users. Does not affect existing users.