In principle, the following is correct:
Code:
chown -R www-data /opt/heimdall
However, there are a few conditions. You need to have permissions to change ownership. /opt/heimdall must reside on a filesystem that has a concept of ownership (as an example, FAT filesystems don't). And the files and directories whose ownership you want to change are not immutable.
Let's start with permissions. You have not yet shown us the output of
ls -ld /opt/heimdall. I would also like to see the output of
ls -l /opt/heimdall, without the d option. You say you have tried root - what exactly did you do?
Next, where does /opt/heimdall reside? Run
lsblk -f to get clarity.
Immutability can be checked with the lsattr command. It is unlikely that /opt/heimdall is immutable, but to ensure it isn't, start with
lsattr /opt.
Finally, Chromebooks run a somewhat nonstandard Linux I believe, and I hesitate with advice to be honest. How did you install Linux on this computer?