Nextcloud no access to occ

Hey!

I’m in big need for help. So I had my Nextcloud server up and running. After I went to do some LDAP changes why server started crashing. I know how to fix it but it’s not working.

Basically there’s an error in my LDAP config file.

sudo -u nextcloud php7.4 /var/www/nextcloud/occ ldap:show-config
When I try to do that I get told that “Could not open input file”.

I already did sudo chmod 744 /var/www/nextcloud/ and sudo chown www-data:www-data /var/www/nextcloud/.

Not sure what I should do now. Any help is appreciated.

you need the -R option on chmod and chown or else it just sets the permissions and ownership on the folder but not its content :slight_smile:

I actually got it to work by giving chown to nextcloud. Now I know my server keeps crashing because of "ldapAgentPassword | *********** | " - This is wrong password.

Now I’m trying to change the password by using sudo -u nextcloud php occ ldap:set-config but I’m not sure how to because right now it’s giving me Not enough arguments (missing: “configID, configKey, configValue”) error.

sudo -u nextcloud php occ ldap:set-config ldapAgentName gave me Not enough arguments (missing: “configKey, configValue”) error. Not sure what’s configKey supposed to mean. Value probably is the new desired password.

https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html?
occ ldap:set-config is used to modify your config so you have to add arguments to tell it what to do.

Tried this sudo -u nextcloud php occ ldap:set-config s01 ldapAgentPassword Newpassword, didn’t work. Gave no error.

Do you have an existing config ? What does ldap:show-config give you ?

I was dumb and changed the password to test if LDAP works. This is what the conf currently looks like, the only thing I changed was the ldapAgentPassword.

So I basically just need to change the password back to what it was.

Yes.

Try to set your ldap password to 123456 to rule out special chars and run sudo -u nextcloud php occ ldap:set-config s01 ldapAgentPassword 123456

Password didn’t change.

Do you have an admin account that logs in without ldap ? if so backup your ldap conf and remove it also try to deactivate the ldap app.

Passwords might be encrypted in conf file :confused:

Yes, I have admin account.

Give this a try https://stackoverflow.com/questions/51465879/how-to-see-ldapagentpassword-of-ldap-configuration-in-plaintext

I’m able to change the ldap port for example, not password.

Let’s say I know what the password is. Would it be easier to change ldapAgentPassword password then?

Did you try the link ? You could decode the actual password from the database and then put it in the config or try to put the password in base64 in your config

I had to add s01 in the query but I found the actual password from my config this way

Yes!

The password was shown as *** but was actually set to 123456. Now I set it to back to what it was, my Nextcloud is working again! Thank you so much, I was going to spend hours on rebuilding my cloud.