I’m trying to run a scan but I can’t do that because I’m using docker. I tried using docker exec without success, here is what I tried and the output:
yotam@server:~$ sudo docker exec nextcloud php occ files:scan
Console has to be executed with the user that owns the file config/config.php
Current user: root
Owner of config.php: www-data
Try adding 'sudo -u www-data ' to the beginning of the command (without the single quotes)
yotam@server:~$ sudo docker exec nextcloud sudo -u www-data php occ files:scan
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"sudo\": executable file not found in $PATH"
How can I scan the files and why does root can’t do it?
if I try : docker exec -u www-data goofy_bohr bash
docker exec --user www-data goofy_bohr bash
or docker exec --user www-data goofy_bohr php occ files:scan
it is not working : the error is
flag provided but not defined: -u or --user
without the option :
Console has to be executed with the user that owns the file config/config.php
Current user: root
Owner of config.php: www-data
Try adding 'sudo -u www-data ’ to the beginning of the command (without the single quotes)
if I try to start a bash
docker exec -it goofy_bohr bash
I have a shell but
bash: sudo: command not found
Finally, it was easy
I see that I can use apt, so I made apt-get update and then apt-get install
after that I can start a shell
and then I can use : sudo -u www-data php /var/www/html/occ files:scan --all
but I do not understand why the flag --user is not working
SeSee, @Daniel_Platteau you need to assign a value to --user. In this case, if you are not a user with powers in php, then it will not happen.
I managed to solve this today, adding: --user = “root”.
I hope you have already solved this, but stay here for anyone who happens to have the same problem today.