Looking for option to not delete user_directory when occ user:delete user aka don't delete user data when removing user

Hello all,

looking for option to not delete user_directory when occ user:delete user aka don’t delete user data when removing user:

 >    [root@nextcloud01 nextcloud]# sudo -u apache php occ user:info jdejong
>       - user_id: jdejong
>       - display_name: Jelle de Jong
>       - email: jdejong@<snip>
>       - cloud_id: jdejong@<snip>/nextcloud
>       - enabled: true
>       - groups:
>         - communications
>         - finance
>         - generalinformation
>         - ipausers
>         - officemanagement
>         - programmes
>       - quota: none
>       - last_seen: 2019-03-17T17:35:47+00:00
>       - user_directory: /home/jdejong
>       - backend: user_saml
> 
>     [root@nextcloud01 nextcloud]# sudo -u apache php occ user:delete jdejong

Will remove all data in /home/jdejong which is not what I want!

That’s the right way to go. If a user is deleted all his data will be deleted too. Unfortunately you’re nit telling us why you don’t want to delete the user directory and data. This prevent everyone from recommending possible workarounds.

Because in my setup the data folder is equal to /home/$user and there are other files in there besides the files folder from nextcloud, it will remove the whole nfs autofs /home/user directory with all the users data. This is not the behaviour I am looking for in my case.

Honestly, this is just a very bad idea. The primary storage is for NC alone, no other application should use it. You should use external storage for your usecase.

Is there a way to disable the user from creating files then in their data folder and only allow the use of the external storage?

sudo -u apache php occ files_external:create -c datadir=/mnt/mamacash/home/\$user / local null::null

I have settled for the following configuration as option. It still seems to have some caching issues, that I hope will be solved in an new release of the external_files app.

1 Like