Nextcloud with SAML and Azure Guest User

Hello all,

I installed UCS Server with Lets Encrypt and Nextcloud. Runs great so far. Even the connection to external storage. A Windows file server. Worked under my Debian installation only partially. with some Windows servers it worked, with some not. Well.

The real problem is that I want to invite external users to our Azure AD as a guest, which works fine so far.
Also the SAML login works fine and the user is in his Nextcloud.
The account of a guest looks like this.

As a username, this is what is in the Nextcloud. = user principal name

This is probably the problem.
Can’t Nextcloud handle the cryptic name?
I can’t delete it from the Nextcloud user management.
I get the message: “An error occurred during the request”.

Did anyone have a solution for this ?

With normal Azure AD users it works fine.

Thanks a lot

Translated with (free version)


you can open a shell:

univention-app shell nextcloud

and execute the following in /var/www/html

I would like to know how does the user UID looks like with:

sudo -u www-data ./occ user:list -i

and is there an error deleting with :

sudo -u www-data ./occ user:delete -vvv 'uid'

Thanks :slight_smile:


the result von occ list command
- user_id:
- display_name: Testuser01
- email:
- cloud_id:
- enabled: true
- groups:
- quota: none
- last_seen: 2022-02-16T15:52:14+00:00
- user_directory: /var/lib/univention-appcenter/apps/nextcloud/data/nextcloud-data/
- backend: user_saml

it is deleteable with the occ command. no errors

I think the Path of the user_directory could be the problem. Maybe the two # are the problem. :roll_eyes:


Yes, a least nextcloud says:

Internal Username:
The internal username is the identifier in Nextcloud for LDAP users. By default it will be created from the UUID attribute. The UUID attribute ensures that the username is unique, and that characters do not need to be converted. Only these characters are allowed: [a-zA-Z0-9_.@-]. Other characters are replaced with their ASCII equivalents, or are simply omitted.


By default, the Nextcloud server creates the user directory in your Nextcloud data directory and gives it the Nextcloud username,

But this is Nextcloud… :wink:

Thanks for the info and confirmation of my suspicion

Ist it possible to change the the name of the userdirectory and the path in the Userconfig? Or is this not recommened?

But thanks for info, now i know the reason. Maybe nextcloud change there something :thinking: or not :slightly_frowning_face:


Your are welcome :slight_smile:

I found this an interesting topic regarding usernames, and might answer your question.

My personal opinion is “keep it simple”.

best regards