Is there option to rename username in Nextcloud without loosing anything ?
Background is, We are migrating to LDAP as a SSO, we have multiple platform on which we will use ldap user to login with SSO. We need to migrate all users of all platorms (taiga, gitlab, nextcloud etc) to LDAP authentication. Demonstration has been made on backup environment.
Only users of Nextcloud have different username comparative to other platform, for example a user “A test” having username atest in all platforms but in Nextcloud he has username testa. Now we need to rename testa to atest. Is it possible? or any workaround?
The username itself is used as a key in many tables, so you can’t easily change it. So the tips often referred to using just a different display name and the mail address, and to keep the real username as a “hidden” user-id.
I am in search of workaround of renaming username. This is very needful in my case almost all local users have been migrated to LDAP, only few users whose local username does not match with other platform.
Fyi, local user migration to LDAP is also not possible officially, but making changes in oc_users made it work. Means this is workaround and worked perfectly
Similarly there must be workaround for renaming username. I tried renaming from oc_user table then it just created new user.
Yes i previously looked into this. Purpose of posting here to find workaround. May be some of the people among us wanted this. So with discussion we can make it possible.
My another test:
I have renamed uid and lower uid in oc_user, then rename data directory of user in data/ with similar to that new username
When i logged in with new renamed user id, all my data available. Issue is that my chat history is not there. Further looking into it.
Lets work together to make it possible, it will help others.
Now I have tested it over a active user in backup environment. Asked him to test all things. The files name that contains username now shows as with new Filename (with new username string) in Nextcloud (there are 1000s of files that are not required to rename) it is because i guess database pointer updated new username in filename (only those files name that contain Username) .
Let me clear, For example Tom is user we renamed Tom username with Toma. Those files that contains Tom in file name also showing as Toma in nextcloud and they do not able to load or Download. It gives internal server error. For example Tom_Certificate.pdf showing as Toma_certificate.pdf. Now there are 1000s of file in specific user directory if they all required to rename it will be nearly impossible.
Hey there. Running occ files:scan --all would fix this for you. You’ve changed the FILES app database entries but not the filenames themselves. files:scan will get everything back in working order.
Yeah. And if you didn’t change the oc_filecache table in the database you wouldn’t need the files:scan step. You can files:scan -all as well, if you’ve got a lot of users and don’t want to do each one by hand
Rescanning is not really good, that means that users have to resync their files!
But there are more problems if you just go through the whole sql file. If you have a user Tom and a user Tomato, you start to rename Tom to Toma, this way you also rename Tomato to Tomaato. And if you have other database entries with “Tom”, it will rename everything…