Sorry for the delay @alex11, I was out of office last week.
So if you run the command:
sudo su daemon -s /bin/bash -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/magento/htdocs/bin/magento setup:di:compile"
Do you still get the permissions error even after running the command below?
sudo chown -R daemon:daemon /opt/bitnami/apps/magento/htdocs
And just to clarify, it is exactly the same to this?
Command line user does not have read and write permissions on generated directory. Please address this issue before using Magento command line.
I'm saying this because it seems like Magento could be trying to write outside of /opt/bitnami/magento/htdocs, but please confirm before.