Skip to content

Move home folders into a subdir of data #18029

Closed

Description

@PVince81

Currently all home folders are directly under "data" and mix up with other folders.
This means that if you create a user called "owncloud.log" or "owncloud.db", it would try and overwrite these files but fail hopefully.

Also having the directories here makes it difficult to find out whether a directory contains metadata (like "data/files_encryption" or other global app-related metadata or whether they are real user folders.

I suggest to move the home folders into a subdirectory, maybe "data/home/$user" instead of "data/$user".

Obviously such a move will require a careful migration.

@schiesbn @MorrisJobke @icewind1991

Activity

  1. MorrisJobke commented on Aug 3, 2015

    @MorrisJobke
    Contributor

    @Raydiation You had similiar issue regarding this with the news app some time back, right?

  2. BernhardPosselt commented on Aug 3, 2015

    @BernhardPosselt
    Contributor

    @MorrisJobke yes :)

    There are two possibilities:

    • Fix the layout in data:
      • positive: easy to manage for existing users since their webserver configs stay the same
      • negative: breaks all apps that access the file system
    • Add an appdata directory
      • positive: apps would have time to migrate, no breakage
      • negative: additional checks on upgrades and installations if the directory is writable and if the directory can directly be accessed by the browser (which it shouldn't)
  3. added this to the backlog milestone on Aug 3, 2015
  4. DeepDiver1975 commented on Aug 3, 2015

    @DeepDiver1975
    Contributor

    Proposal:
    user data goes into data/u/{uid}
    group data goes into data/g/{gid}
    app data goes into data/a/{aid}

    Any changes in this area would require explicit storing of the users home in the user configuration.

  5. DeepDiver1975 commented on Aug 3, 2015

    @DeepDiver1975
    Contributor

    group data goes into data/g/{gid}

    this is necessary as soon as someone wants to implement something like a group workspace or something like that

  6. MorrisJobke commented on Aug 3, 2015

    @MorrisJobke
    Contributor

    Any changes in this area would require explicit storing of the users home in the user configuration.

    @DeepDiver1975 Do we then also disallow special home folder naming rules as known by user_ldap?

  7. BernhardPosselt commented on Aug 3, 2015

    @BernhardPosselt
    Contributor

    Side note: I'd write out the names e.g. data/users, data/groups and data/apps. It's not a lot longer but way easier to understand for an admin

  8. DeepDiver1975 commented on Aug 3, 2015

    @DeepDiver1975
    Contributor

    @DeepDiver1975 Do we then also disallow special home folder naming rules as known by user_ldap?

    Can you please elaborate the context of this question? THX

  9. LukasReschke commented on Aug 4, 2015

    @LukasReschke
    Contributor

    Will also fix #10767

  10. schiessle commented on Aug 4, 2015

    @schiessle
    Contributor

    I like this proposal #18029 (comment) by @DeepDiver1975 but I also agree with @Raydiation, better write out the name, way easier to understand and I don't see a reason why the directory name should be only one letter.

    Though, the hard part here is the migration. There are thousands of places where we create paths manually. Maybe we can map them internally for some time to make migration easier.

    If we implement this directory structure we should also provide some helper method to get the user, group, app directory so that users don't have to construct the paths manually.

  11. DeepDiver1975 commented on Aug 4, 2015

    @DeepDiver1975
    Contributor

    better write out the name

    fine by me 🙈

  12. DeepDiver1975 commented on Aug 4, 2015

    @DeepDiver1975
    Contributor

    Though, the hard part here is the migration. There are thousands of places where we create paths manually. Maybe we can map them internally for some time to make migration easier.

    And also the migration of existing installations - this will no be easy.

    Since we have no understanding of the individual system setup we need to leave this completely to the admin. e.g. there are setups where the user homes are mounted to NFS servers - we cannot start to move around folders.

  13. karlitschek commented on Aug 4, 2015

    @karlitschek
    Contributor

    i agree. moving all files and folders automatically around during migration is too dangerous and not an option. we need a different solution whatever it is.

  14. 4 remaining items

  15. butonic commented on Sep 22, 2016

    @butonic
    Contributor

    On installations with tens of thousands of users it would make sense to prefix users and sort them into subfolders, eg /path/to/data/a/d/admin. That would leave us with ~40 single char folders for users in the data folder.

    Any metadata folders should be prefixed with _ so they sort nicely. _avatars comes to mind. Probably _lucene_index but we have app folders for that. If we want to stay with that logic the avatars should be in /path/to/data/core/avatars.

    I'd not use .hidden folders because I don't want admins asking 'Where can I find xyz' just because they didn't do an ls -h.

    We could move the users to /path/to/data/users but actually /path/to/data/files makes more sense because that is the app that handles all files.

    a global /path/to/data/cache makes sense, /path/to/data/thumbnails and /path/to/data/encryption as well because you can place all of these on different storage types if you want. For an easy setup with muliple webservers we could even put tmp in the data folder.

    While moving files out of the users home might seem flimsy because deleting a user would require looking in multiple places I think it actually makes sense, because we get rid of thumbnails and cache entries in the filecache.

    Thinking this further, files_versions and files_trashbin should live in their own folders as well. I'd propose using /path/to/data/<appid>/users/a/d/admin style locations for anything file related. Which, come to think of it, just turns around what we currently have: /path/to/data/<userid>/<appid>.

    Why is /path/to/data/<appid>/users/a/d/admin better? It allows for a better separation of storages. We already introduced config flags for the cache and tmp locations, this just makes apps the first level item. I don't see a reason why we need to have eg. thumbnails in our virtual fs, or anything that isn't synced, such as trashbin, versions and encryption keys (we are doing stunts during fs setup for the latter anyway).

    Regarding migration: By default we should look inside the new style path and fall back to the old style path. Only files, trashbin and versions need to be moved, thumbnails will just fade out (but we could move them as well). Any migration should be triggered by an OCC command (and an action in the users web ui).

    Which brings us to the naming rule for home folders. As @DeepDiver1975 mentioned we will store the home folder as a preference for a user, so that even when the admin changes the naming rule, eg from admin to ././admin nothing changes for users that already have a home initialized. The admin can then move the data and change the user specific home folder naming rule as he sees fit.

    So, where do we put avatars? An avatar makes no sense without a user and users are managed by core as a setting for a user: /path/to/data/core/users/a/d/admin/avatar.jpg You could argue that user management is like an app, so /path/to/data/users/a/d/admin/avatar.jpg is fine by me.

    So this is a little different than #18029 (comment). Migration may not be easy, but we need to take care of the storage anyway.

    At least that is my opinion.

  16. PVince81 commented on Sep 22, 2016

    @PVince81
    ContributorAuthor

    store the home folder as a preference for a user

    yes, or in the future user list table.

  17. PVince81 commented on Sep 22, 2016

    @PVince81
    ContributorAuthor

    the advantage of having the metadata in a main folder "_metadata/" is that some admins will want to mount it on different storages than the files.
    But if we embed it inside as before this won't be possible. Unless again we have additional user preference keys to specify the path for the metadata of each app...

  18. butonic commented on Sep 22, 2016

    @butonic
    Contributor

    Lets try to keep this simple and agree to a default scheme that is logical and allows admins to easily mount a differen type of storage for a certain aspect, eg. tmp, cache or thumbnails.
    I propose /path/to/data/<aspect>/a/d/admin/ with aspect being eg files, files_trashbin, files_versions, encryption or any other app. But it can also be tmp, users, groups, cache, thumbnails ...

    Then why not have avatars as an aspect? I think avatars are tightly coupled with user management ... and bascally _ already indicates metadata. Admins might want to put _metadata/avatars on a different storage than _metadata/cache (if we decide to put it there).

    We could prefix non app dirs with _ to distinguish them.

    I dislike the _metadata folder because I would like to keep the hierarchy in the data folder the same.

    I can agree to /path/to/data/_avatars/a/d/admin.jpg ...

  19. butonic commented on Sep 22, 2016

    @butonic
    Contributor

    @DeepDiver1975 what is your opinion?

  20. PVince81 commented on Sep 27, 2016

    @PVince81
    ContributorAuthor

    We could extend IRootFolder to provide another method getMetadataFolderForUser($userId, $metadataType)

  21. PVince81 commented on Sep 27, 2016

    @PVince81
    ContributorAuthor

    or if we consider "files" to be a data type, then just have it be getUserDataFolder($userId, $type == 'files'). And we need to stop using the root folder and stop assuming the folder structure and always go through these methods.

  22. PVince81 commented on Oct 10, 2016

    @PVince81
    ContributorAuthor

    related #17005

  23. PVince81 commented on Sep 11, 2017

    @PVince81
    ContributorAuthor

    The oc_accounts table now contain the full path to the home folder, so it would be possible to introduce the change above without affecting the existing homes.

    Then a command needs to be provided to optionally migrate those old homes to the new paths.

  24. Mayeu commented on May 15, 2019

    @Mayeu

    Any ETA of when the home folder would be moved to their own subdir?

    We have encountered this issue today while updating our LDAP configuration. One of our users is named meta and after the configuration change in LDAP we ended up with the same issue described in #32547.

    Is it safe to change the home folder path manually in the database, or does ownCloud will fix it by itself on the next LDAP sync?

  25. PVince81 commented on May 15, 2019

    @PVince81
    ContributorAuthor

    @Mayeu this ticket was mostly for non-LDAP scenarios.

    with LDAP you should already be able to specify custom home folders using the matching attribute (see advanced tab to configure it). then for every user you can have that attribute provide an absolute path to their homes.

  26. Mayeu commented on May 20, 2019

    @Mayeu

    @PVince81: Thank you for your response. Assuming I have access in the LDAP directory to other fields that don't clash with ownCloud and that are 100% sure to be unique yes :)

    In our case that means that I plan to go back to uuid as home folders, even it if make dealing with the filesystem harder in debugging situation.

    I anyway really hope this improvement to happen, it does not feels really safe to store everything in one folder 😅

  27. stale commented on Sep 21, 2021

    @stale

    This issue has been automatically closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions