There is an application that creates logs owned by root
user (this cannot be changed, at least in my work environment) in the directory logs:
This app is executed through a docker-compose and Makefile, and it will be stopped and resumed several times. So I want to execute the app, it will generate logs, stop the app and delete the logs and after a certain amount of time, execute the app again, which will generate new logs.
Deleting the logs (all the subfolders and files that are within the logs folder) has to be done with the command rm -rf logs
, without sudo
involved, because it is made by a Makefile that is also executed in Mac computers. In Mac, if you have a sudo
command, it will ask for a password, and I don't want that.
I have added write permissions to the folder with sudo chmod a+rwx
and sudo chmod 777
(have tried both because didn't make it work), which according to a few questions might be enough.
I have also added the ubuntu user to the root group as stated in for example https://unix.stackexchange.com/a/139284, with:
adduser ubuntu root
And
usermod -aG root sysadmin
Following this, https://askubuntu.com/a/213959/999435, I have restarted the server after that.
But still, I am unable to remove the files. How could I do this?