Loading
Go to NextCloud
r/NextCloud
Nextcloud is an open source, self-hosted file sync & communication app platform. Access & sync your files, contacts, calendars and communicate & collaborate across your devices. You decide what happens with your data, where it is and who can access it!
If you have questions for use in a company or government at scale (>1000 users), do yourself a favor and contact Nextcloud itself — this community is mostly home-user focused!
Members
Online
•
The username is already being used Error
I am trying to configure my nextCloud installation and I can’t seem to get past the «create admin» screen. When i Try to connect to my MySql installation — it gives me the above error. If I use a «new» user, it says that user does not have permission on the database? (obviously) I don’t understand what kind of user I am supposed to use in this case.
Does anyone know a way around this?
We’re using Nextcloud as a file upload/download front-end for a single-user application. This means we are running a Docker image with two volumes attached:
./nextcloud:/var/www/html
./userdata:/var/www/html/data/the_user/files
The userdata
volume is attached to another service that creates and removes files from it. Our setup periodically runs files:scan --all
to keep Nextcloud up to date.
In prior versions the above setup worked fine. In nextcloud 18, one gets the error Username is invalid because files already exist for this user
when creating a user with a data directory that already exists, but creating such a user is exactly my intention.
Steps to reproduce
mkdir -p userdata/stuff && touch userdata/stuff/a_file
docker run --rm --name nextcloud -e POSTGRES_... -v $PWD/nextcloud:/var/www/html -v $PWD/userdata:/var/www/html/data/the_user/files nextcloud:18
docker exec nextcloud php occ maintenance:install
docker exec nextcloud php occ user:add the_user
Expected behaviour
The user is created. The pre-populated user data is found when running php occ files:scan -all
.
Actual behaviour
The message Username is invalid because files already exist for this user
is printed to stdout
.
Server configuration
Operating system: Ubuntu 18
Web server: Apache/2.4.38 (Debian)
Database: postgres 12
PHP version: PHP/7.3.17
Nextcloud version: 18.0.4.2
Questions
- Is there some flag to
user:add
that supresses this check and I missed it?- If not, would such a flag be a welcome addition to nextcloud?
- I can’t seem to locate the
if
that generates this error in this repository. I wish to remove this check in a fork; can someone point me to the right direction? - Is there a reason for this changed behaviour?
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I’ve searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- Nextcloud Server is running on 64bit capable CPU, PHP and OS.
- I agree to follow Nextcloud’s Code of Conduct.
Bug description
When trying to add a new user with a defined display name, you’ll receive a notification that the user already exists. It get’s added anyway, but no invitation email is send. Leaving this field (display name) empty, it works fine.
Steps to reproduce
- Login as an admin user
- start creating a new user
- choose some display name besides username and password
- confirm the dialog
- see the popup in the upper right corner stating «user already exists»
- klick somewhere on the site so the dialog disappears
- note that the user is not displayed in the user list
- reload the page an note that the user is magically there
Expected behavior
Adding a new user (that has not been present before) with a selected display name should just work without any error messages.
Installation method
Community Docker image
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.0
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Updated from a minor version (ex. 22.2.3 to 22.2.4)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO — SAML
- Other
Configuration report
{ "system": { "htaccess.RewriteBase": "\/", "memcache.local": "\\OC\\Memcache\\APCu", "memcache.distributed": "\\OC\\Memcache\\Redis", "memcache.locking": "\\OC\\Memcache\\Redis", "filelocking.enabled": "true", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "password": "***REMOVED SENSITIVE VALUE***", "port": 6379 }, "apps_paths": [ { "path": "\/var\/www\/html\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/www\/html\/custom_apps", "url": "\/custom_apps", "writable": true } ], "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "nirwananextcloud.ddns.net" ], "trusted_proxies": "***REMOVED SENSITIVE VALUE***", "onlyoffice": { "verifiy_peer_off": true }, "allow_local_remote_servers": true, "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "mysql.utf8mb4": true, "version": "24.0.5.1", "overwrite.cli.url": "http:\/\/nc.tibeer.de", "overwriteprotocol": "https", "installed": true, "default_phone_region": "DE", "theme": "", "loglevel": 0, "maintenance": false, "skeletondirectory": "", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_sendmailmode": "smtp", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "tls", "mail_smtpauthtype": "LOGIN", "mail_smtpauth": 1, "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***" } }
List of activated Apps
Enabled: - accessibility: 1.10.0 - circles: 24.0.1 - cloud_federation_api: 1.7.0 - comments: 1.14.0 - contactsinteraction: 1.5.0 - dav: 1.22.0 - federatedfilesharing: 1.14.0 - federation: 1.14.0 - files: 1.19.0 - files_pdfviewer: 2.5.0 - files_rightclick: 1.3.0 - files_sharing: 1.16.2 - files_trashbin: 1.14.0 - files_versions: 1.17.0 - files_videoplayer: 1.13.0 - firstrunwizard: 2.13.0 - logreader: 2.9.0 - lookup_server_connector: 1.12.0 - nextcloud_announcements: 1.13.0 - notifications: 2.12.1 - oauth2: 1.12.0 - password_policy: 1.14.0 - photos: 1.6.0 - privacy: 1.8.0 - provisioning_api: 1.14.0 - serverinfo: 1.14.0 - settings: 1.6.0 - sharebymail: 1.14.0 - support: 1.7.0 - survey_client: 1.12.0 - text: 3.5.1 - theming: 1.15.0 - twofactor_backupcodes: 1.13.0 - updatenotification: 1.14.0 - user_status: 1.4.0 - viewer: 1.8.0 - weather_status: 1.4.0 - workflowengine: 2.6.0 Disabled: - activity: 2.13.4 - admin_audit - dashboard: 7.0.0 - encryption - files_external - recommendations: 0.8.0 - systemtags: 1.6.0 - user_ldap
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
Fehlersuche scss_cacher SCSSCacher::isCached ca9f-bd3a-settings.css dependencies successfully cached for 5 minutes 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached ca9f-bd3a-settings.css isCachedCache is expired or unset 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached 1bf6-bd3a-user-status-menu.css dependencies successfully cached for 5 minutes 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached 1bf6-bd3a-user-status-menu.css isCachedCache is expired or unset 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached ae3e-bd3a-styles.css dependencies successfully cached for 5 minutes 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached ae3e-bd3a-styles.css isCachedCache is expired or unset 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:30:35+0200 Fehlersuche logreader Could not find resource file "/apps/logreader/css/../js/logreader-main.css" 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached 7fcc-bd3a-css-variables.css dependencies successfully cached for 5 minutes 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached 7fcc-bd3a-css-variables.css isCachedCache is expired or unset 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached 7fcc-bd3a-server.css dependencies successfully cached for 5 minutes 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::isCached 7fcc-bd3a-server.css isCachedCache is expired or unset 2022-10-06T11:30:35+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:30:35+0200 Information no app in context Symfony\Component\Routing\Exception\RouteNotFoundException: Unable to generate a URL for the named route "contacts.contacts.directcircle" as such route does not exist. 2022-10-06T11:25:37+0200 Information no app in context Symfony\Component\Routing\Exception\RouteNotFoundException: Unable to generate a URL for the named route "contacts.contacts.directcircle" as such route does not exist. 2022-10-06T11:25:36+0200 Fehlersuche scss_cacher SCSSCacher::isCached ca9f-bd3a-settings.css dependencies successfully cached for 5 minutes 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::isCached ca9f-bd3a-settings.css isCachedCache is expired or unset 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::isCached 1bf6-bd3a-user-status-menu.css dependencies successfully cached for 5 minutes 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::isCached 1bf6-bd3a-user-status-menu.css isCachedCache is expired or unset 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::isCached ae3e-bd3a-styles.css dependencies successfully cached for 5 minutes 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::isCached ae3e-bd3a-styles.css isCachedCache is expired or unset 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:56+0200 Fehlersuche logreader Could not find resource file "/apps/logreader/css/../js/logreader-main.css" 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:56+0200 Fehlersuche scss_cacher SCSSCacher::isCached 7fcc-bd3a-css-variables.css dependencies successfully cached for 5 minutes 2022-10-06T11:24:48+0200 Fehlersuche scss_cacher SCSSCacher::isCached 7fcc-bd3a-css-variables.css isCachedCache is expired or unset 2022-10-06T11:24:48+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:48+0200 Fehlersuche scss_cacher SCSSCacher::isCached 7fcc-bd3a-server.css dependencies successfully cached for 5 minutes 2022-10-06T11:24:48+0200 Fehlersuche scss_cacher SCSSCacher::isCached 7fcc-bd3a-server.css isCachedCache is expired or unset 2022-10-06T11:24:48+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:24:48+0200 Fehlersuche scss_cacher SCSSCacher::isCached ca9f-bd3a-settings.css dependencies successfully cached for 5 minutes 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::isCached ca9f-bd3a-settings.css isCachedCache is expired or unset 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::isCached 1bf6-bd3a-user-status-menu.css dependencies successfully cached for 5 minutes 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::isCached 1bf6-bd3a-user-status-menu.css isCachedCache is expired or unset 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::isCached ae3e-bd3a-styles.css dependencies successfully cached for 5 minutes 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::isCached ae3e-bd3a-styles.css isCachedCache is expired or unset 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:14:26+0200 Fehlersuche logreader Could not find resource file "/apps/logreader/css/../js/logreader-main.css" 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows 2022-10-06T11:14:26+0200 Fehlersuche scss_cacher SCSSCacher::process ordinary check follows
Additional info
Tested with multiple Browsers (also cleared the cache). To be extra sure used a device which has never connected to this nextcloud before, issue persists.
Also not provided all Nextcloud Logs as it crashes the GitHub form due to too much content of the logfile.
При администрировании сервера NextCloud (примерно на 500 пользователей), с авторизацией через Active Directory столкнулся со следующей проблемой:
Если у пользователя в AD логин из русских букв — то в облако его не пустит, а в логах NextCloud будут сыпаться ошибки вида:
{"reqId":"CiEIVGJ\/b9ozGxZuHPpH","remoteAddr":"10.101.0.16","app":"user_ldap","message":"uid for 'cn=\u044e\u0433\u043e\u0432 \u0434\u0430\u043d\u0438\u0438\u043b \u0430\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440\u043e\u0432\u0438\u0447,ou=users,ou=uk,dc=corp,dc=organization,dc=loc' must not be an empty string","level":3,"time":"2017-06-14 14:28:10","method":"GET","url":"\/settings\/users\/users?offset=0&limit=50&gid=&pattern=","user":"admin","version":"11.0.3.2"}
и в административной панели перестанут отображаться пользователи.
Из документации:
NextCloud использует имена пользователей для хранения и назначения метаданных. Для точной идентификации и распознавания пользователей, каждый пользователь LDAP будет иметь свое внутреннее имя пользователя. Это требует привязки имени пользователя NextCloud к пользователю LDAP. При создании имя пользователя назначается идентификатору UUID пользователя LDAP. Помимо этого кешируется DN для уменьшения числа обращений к LDAP, однако он не используется для идентификации. Если DN был изменён, то изменения будут найдены. Внутреннее имя NextCloud используется повсеместно в ownCloud.
Данные соответствия хранятся в базе MySQL в таблице oc_ldap_user_mapping, со структурой:
ldap_dn | owncloud_name | directory_uuid |
cn=Ivan Petrov,ou=manager,ou=users,ou=uk,dc=corp,dc=organization,dc=loc | IPetrov | 94332767-6CDD-440B-B174-3B36666A2EF8 |
И после того, как такой пользователь AD с русскоязычным логином попытается войти в свой аккаунт, в таблице создастся аналогичная запись, но с пустой ячейкой owncloud_name:
ldap_dn | owncloud_name | directory_uuid |
cn=???? ??????,ou=manager,ou=users,ou=uk,dc=corp,dc=organization,dc=loc | 94332767-6CDD-440B-B174-3B36666A2EF8 |
Из-за этого и перестает корректно отображаться список пользователей в панели администратора.
Как исправить?
Чтобы исправить эту ошибку, нужно подключиться к базе данных облака, и вручную удалить неполную запись:
delete from oc_ldap_user_mapping where directory_uuid = "UUID пользователя с пустой owncloud_name";
После этого нужно изменить логин пользователя в Active Directory на латиницу, и в панели администратора NextCloud, в разделе Интеграция LDAP/AD, на вкладке Эксперт нажать на Очистить соответствия Имя — пользователь LDAP.
Теперь пользователь сможет нормально авторизоваться, а список пользователей в админке будет корректно отображаться. Дабы в будущем избежать подобных проблем — рекомендую пользователям при создании делать логины на латинице, а тех, у кого логин русскоязычный — либо переименовывать, либо исключать из группы, с которая имеет право авторизовываться в облаке, иначе будут возникать вышеуказанные ошибки.