Permissions error when updating Mautic 3.2

Mautic
My PHP version is : 7.2
My MySQL/MariaDB version is (delete as applicable): MySQL

Updating/Installing Errors
I am (delete as applicable): Updating
Upgrading/installing via (delete as applicable) : Command Line

These errors are showing in the installer :

Step 4 [---->-----------------------] Extracting PackagePHP Warning: ZipArchive::extractTo(/opt/bitnami/apps/mautic/htdocs/.htaccess): failed to open stream: Permission denied in /opt/bitnami/apps/mautic/htdocs/app/bundles/CoreBundle/Update/Step/InstallNewFilesStep.php on line 91

The Mautic update could not complete successfully because of the following error: Could not extract the contents of the ZIP archive to the filesystem.

These errors are showing in the Mautic log :

These errors are showing in the upgrade_log.txt file (located in the root of your Mautic instance when an upgrade has been attempted - ensure you remove or redact any sensitive data such as domain names in the file path) :

Your problem
My problem is : I want to update Mautic from 3.1.2 to 3.2 and I get the following error.

Steps I have tried to fix the problem : -

Looks like you don’t have enough permissions to write in /opt/bitnami/apps/mautic/htdocs/ or to override /opt/bitnami/apps/mautic/htdocs/.htaccess

It could depend on many factors, check folder’s owner and see your own user permissions.

I don’t know the Bitnami setup, maybe they prevent you to override .htaccess?

Solved!

I just managed to update Mautic to 3.2.1

Previously it was updated by a programmer, so I opened the history to see how he did it.

The commands is as follows:

sudo su -
cd /opt/bitnami/apps/mautic/htdocs
php bin/console mautic:update:apply
php bin/console mautic:update:apply --finish

I really don’t know what the problem is and why these commands work.

If anyone has an explanation or a solution to make it work with normal commands again, I appreciate it.

Thank you very much for your help.

Franco.