Config.php share_folder works only for new shares

Hey community,

one of my colleagues told me we have a little problem. All shared files/folders are in the root directory and not in the subfolder “Shared” and asked if I happen to know what I did the last two days.

Well for sure I know. I added a new drive for our owncloud data directory, used “rsync -auv --delete /active-cloud-data-dir/ /new-cloud-data-dir” to prepare everything. Then stopped the apache2, enabled maintenance mode, unmounted the active-cloud-data-dir and mounted the new-cloud-data-dir to the old mountpoint to save the hassle with editing stuff in the database etc. Then I turned off maintenance mode and started the apache2. Checked everything and ran an […] occ file:scan --all
Everything seemed fine. Then the question was asked. I’ve tested many things, and new shares are added below /Shared. Now after hours of research I’m turing to the swarm. Is there a method to “rescan” all shares and re-add or move them back to /Shared or do we have to re-share everything in order to accomplish this?

Steps to reproduce

  1. Share a file/folder → appears in users root directory
  2. set ‘share_folder’ in config.php to ‘/Shared’
  3. Shared file/folder still appears in users root directory
  4. Share a new file/folder → appears in Shared folder

Expected behaviour

All shared files/folders should be in users root directory when ‘share_folder’ is not set, and in subfolder Shared when it is set.

Actual behaviour

Only works on new files/folders when option is set.

Server configuration

Operating system:
Ubuntu 20.04 LTS

Web server:


PHP version:

ownCloud version: (see ownCloud admin page)
10.11.0 (production)

Login as admin user into your ownCloud and access 
paste the results into and puth the link here.

→ No errors have been found.

The content of config/config.php:

$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'passwordsalt' => 'xxxxx',
  'datadirectory' => '/srv/owncloud',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'xxxxx_owncloud',
  'dbhost' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'xxxxx',
  'dbpassword' => 'xxxxx',
  'installed' => true,
  'instanceid' => 'xxxxxb214be4',
  'loglevel' => 1,
  'maintenance' => false,
  'forcessl' => true,
  'theme' => '',
  'log_type' => 'owncloud',
  'logfile' => '/var/log/owncloud.log',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/',
      'url' => '/apps',
      'writable' => false,
    1 =>
    array (
      'path' => '/var/www/',
      'url' => '/foreignapps',
      'writable' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => '',
  'mail_smtpport' => 'xxx',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtptimeout' => 30,
  'mail_domain' => '',
  'mail_smtpdebug' => false,
  'trusted_domains' =>
  array (
    0 => '',
  'share_folder' => '/Shared',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'mail_from_address' => 'xxxxx-Owncloud',
  'trashbin_retention_obligation' => 'auto',
  'appstore.experimental.enabled' => true,
  'allow_user_to_change_mail_address' => '',

List of activated apps:

  - activity:
    - Version: 2.7.1
    - Path: /var/www/
  - brute_force_protection:
    - Version: 1.2.0
    - Path: /var/www/
  - calendar:
    - Version: 2.0.0
    - Path: /var/www/
  - comments:
    - Version: 0.3.0
    - Path: /var/www/
  - configreport:
    - Version: 0.2.1
    - Path: /var/www/
  - contacts:
    - Version: 1.5.5
    - Path: /var/www/
  - dav:
    - Version: 0.7.0
    - Path: /var/www/
  - external:
    - Version: 1.4.0
    - Path: /var/www/
  - federatedfilesharing:
    - Version: 0.5.0
    - Path: /var/www/
  - federation:
    - Version: 0.1.0
    - Path: /var/www/
  - files:
    - Version: 1.5.2
    - Path: /var/www/
  - files_mediaviewer:
    - Version: 1.0.5
    - Path: /var/www/
  - files_pdfviewer:
    - Version: 1.0.1
    - Path: /var/www/
  - files_sharing:
    - Version: 0.14.0
    - Path: /var/www/
  - files_texteditor:
    - Version: 2.5.1
    - Path: /var/www/
  - files_trashbin:
    - Version: 0.9.1
    - Path: /var/www/
  - files_versions:
    - Version: 1.3.0
    - Path: /var/www/
  - files_videoplayer:
    - Version: 0.10.1
    - Path: /var/www/
  - firstrunwizard:
    - Version: 1.2.0
    - Path: /var/www/
  - gallery:
    - Version: 16.1.2
    - Path: /var/www/
  - market:
    - Version: 0.7.0
    - Path: /var/www/
  - notifications:
    - Version: 0.5.4
    - Path: /var/www/
  - password_policy:
    - Version: 2.1.4
    - Path: /var/www/
  - provisioning_api:
    - Version: 0.5.0
    - Path: /var/www/
  - systemtags:
    - Version: 0.3.0
    - Path: /var/www/
  - templateeditor:
    - Version: 0.4.0
    - Path: /var/www/
  - updatenotification:
    - Version: 0.2.1
    - Path: /var/www/
  - user_external:
    - Version: 0.6.0
    - Path: /var/www/
  - encryption:
    - Path: /var/www/
  - files_external:
    - Path: /var/www/

Are you using encryption: no

Hope the provided informations are sufficient.

Thx for your time reading to the end.

I hope someone will have a hint what to do. Have a nice day,

Hi Andreas,
I don’t know if there is an automated way to move all shared files into the “/Shared” folder, but you can move them manually through the web interface by dragging them(you can tag them all by clicking on the file icon and move them all at once). The config value only affects new shares and not previous.
Hope this helps,

1 Like

Thanks for your answer Valentin. But it does not help, since we have to move them for all users. What’s ugly about the situation is, that until I changed the data folder to the new and bigger one they were inside the “/Shared” folder and there were no other configuration changes. Heck, the changes were on the OS level not on the application level or in the applications config. Why does something like this happen -_-

Well, has someone an Idea how I could fix this, maybe with ./occ or updating something in the database?

Thx again,

You can also use a database operation, the table you have to edit is oc_share. I tested in my instance and the command update oc_share set file_target= concat("/Shared",file_target) where file_target not like "/Shared/%" and (share_type = 0 or share_type = 1); worked for me. The command checks if the entry already is a folder named /Shared, only affects shares to users(0) and groups(1) and adds /Shared to the beginning of those entries. Please check if your folder is /Shared or /shared, since it is case sensitive. You can maybe do some tests before running the command, like checking oc_share with select * from oc_share; and looking at all shares affected with select * from oc_share where file_target not like "/Shared/%" and (share_type = 0 or share_type = 1); Feel free to ask if you have questions
Best regards,


Maybe even test the command first on only one file with update oc_share set file_target= concat("/Shared",file_target) where file_target ="filename"; with a value taken from file_target as filename.

1 Like

Thx very much, I’m wrestling with the select command and searching for a suited file to test with. Seems doable at the moment. But I’m a little rusty in mysql :sweat_smile: Most times I only create empty databases and grant permission. But I’m confident thanks to your input. I’ll report when I’ve finished the path updates.

I’m confused. We have share_type 0, 2 and 3. No 1. In the 10.7_ownCloud_Developer_Manual.pdf there are only share_type 0 (user), 1 (group), 3 (public link), 6 (federated cloud share) and the ones with type 2 seem to be our group… Have to investigate more. Do you have another hint what I’m looking at.

you can test if 2 is groups by creating a new group share and looking up the file in oc_share, but it could be that type 2 was previously used for groups.

1 Like

The test was successfull. Thanks.
About share_type 2 I found a hint here in central, something about group by parent, will look further into that.

Found it here:

Thanks again.

1 Like

I was a little weak-kneed to use your update statement in cli :innocent: - So I used MySQL Workbench to change every single of about 50 values by hand. It worked.

Thanks a lot,


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.