I know this is getting into the nuts and bolts of Nextcloud, but really hoping someone can help. Please note that I am doing this on a test server and NOT a production server.
When I initially setup our production Nextcloud server, I did not have the ‘samaccountname’ set in the ldap expert tab and now have numeric usernams such as this 0A219BE3-9738-4F2F-B5B2-348DE68F2791. I have made the correction in the ladap/expert tab and all new users have their correct usernames. However, I still have a several users which still have the numeric username and would like to correct.
The only way I have found to do this is to delete the user and recreate their account. Then I restore their data directories form back up then run the occ command files:scan. The following are the steps Ive taken to remove and restore user accounts.
1. Remove user from Active Directory group. 2. With the use of MySQL Workbench, delete user record from two database tables "oc_accounts" and "oc_ldap_user_mapping". 3. Move user back into the Active Directory group. Nextcloud sees AD/LADP as new user and create new account with correct Username. 4. Restore uses folder/files from back up in new user home directory and then run occ file scan.
After this, user is back online with all data and proper username id, however, all shares created under the old user profile no longer exists.
With that said, there must be a way to manipulate the database to restore users shares. I would guess its a matter of redirecting the relationships between that tables by manipulating records. I suspect the following tables are of interest, but have not yet found relationships that would fix this.
oc_share - This is the most interesting table
Maybe there is a much easier way to do this. Hope someone can help! It would be great to have the capability to restore user shares somehow built into Nextcloud Admin.