Changing Nextcloud Username - ODIC Migration


for several years iam running a Nextcloud Instance for my family and friends. In this time i used the Email as Nextcloud Username.

Now i decided to try to connect my Nextcloud with my OpenID Connect Provider. So i connected my Cloud with Keycloak by using Pulsejet OIDC Plugin. For the Username i wanted to use the user keycloak id (sub) eg. caac4a48-fb12-4f05-999b-823c362d9a

So now i need to change the usernames of the existing users (email to sub id) to migrate them to the new OIDC Login System.

If you dont migrate and the just log in with the OIDC, Nextcloud will create a new Account.

The question is now: Is it possible to change the username (in files and database?) or to transfer all data like files and database entries (also data from e.g. the Passwords app, Calendar) to the new user Account?

The Username should be changed from an email to a sub id.

Maybe with a tool or command?

Nextcloud version: 20.0.0
Operating system and version: Ubuntu 18
Apache or nginx version: Apache
PHP version: 7.4

Thank you for helping!

Can you please describe your problem in more than one sentence, provide examples and explain IN DETAIL what happens at what time, so that other users can try to replicate the problem.

1 Like

Hello j-ed,

thank you for answering. I updated my post. :+1:

1 Like

This is also not working on Nextcloud 21.0.0

Same issue. Is there any progress?

Unfortunatel it isn’t possible to rename a login by design because the login is used as an unique identifier within Nextcloud. A possible way to work around that problem, is to create a new user and then transfer all data to the new user using the occ command files:transfer-ownership).

1 Like