Nextcloud broken after i removed ldap configuration

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.2.11.3
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes → see below
If yes, please explain:
Nextcloud version: 28.0.4~ynh2

Description of my issue

I had an error message related to ldap in my nextcloud logs. I didn’t know what it was used for so i made a big mistake : i went to the admin settings and i deleted the Ldap sever :

I don"t remember how it was configured, there was something with my username a yunohost directory. Nextcloud crashed and is now unavailable, i can not open this app to go back in the admin panel.

How can i set it up like it use to be with command lines ? I have used occ commands before.

I don’t want to restore my backup because i am scared to lose my medias.

Hi piwax,

What an unfortunate situation!

I don’t know enough about LDAP to help you out. You could install a second Nextcloud to see how it is configured, and install phpLDAPadmin to compare the credentials for the two Nextclouds.

What do you mean by that?

Here’s the default config: nextcloud_ynh/conf/config.json at b05bcf5b4f30ca1c9e2e15efee6c2a7056e76fa6 · YunoHost-Apps/nextcloud_ynh · GitHub

And how it appears on the tab you’ve shown:

Also note your screenshot shows 3rd item in the dropdown, perhaps localhost config is still there?

My last complete server backup is one month old.
The last automatic backup of the nextcloud app by yunohost is very recent but it doesn’t contain the medias. I would have to save them somewhere else and paste them back in the folder hopping it doesn’t break anything.

My screenshot comes from the official nextcloud documentation. I don’t have access to this admin panel anymore

Thanks for your help.
I searched for a config.json file to edit in the /var/www/nextcloud folder but i didn’t find anything like that.
In which file am i supposed to paste those default config parameters ?

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#ldap-commands-label
Since you deleted the app, you will have to install it before proceeding to its configuration

2 Likes

I didn’t delete the nextcloud app, i just clicked on the Bin icon on the screenshot i shared. So i just deleted the LDAP server configuration.
Tomorrow i will try to configure it with the occ commands you sent

1 Like

And if you’re confortable with sql, you can look in the nextcloud database for oc_appconfig table and search for user_ldap. You can try importing a copy of that specific config from a backup or another install

2 Likes

Thanks a lot to all of you, my nextcloud is now operational again !
I used the following commands

root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapBase "dc=yunohost,dc=org"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapBaseGroups "ou=groups,dc=yunohost,dc=org"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapBaseUsers "ou=users,dc=yunohost,dc=org"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapConfigurationActive "1"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapEmailAttribute "mail"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapExpertUsernameAttr "uid"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapGroupFilter "(&(objectclass=top)(memberUid=*))"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapGroupFilterObjectclass "posixGroup"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapGroupMemberAssocAttr "memberUid"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapHost "localhost"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapLoginFilter "(&(|(objectclass=posixAccount))(uid=%uid)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapPort "389"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapQuotaAttribute "userquota"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapUserDisplayName "cn"
root@gandi-server:~# sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapUserFilterObjectclass "posixAccount"
3 Likes

Just for this line you should replace __APP__ by the name of the application, I imagine nextcloud

sudo -u nextcloud php8.2 --define apc.enable_cli=1 /var/www/nextcloud/occ ldap:set-config s01 ldapLoginFilter "(&(|(objectclass=posixAccount))(uid=%uid)(permission=cn=nextcloud.main,ou=permission,dc=yunohost,dc=org))"
1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.