Skip to content

Instantly share code, notes, and snippets.

@fhdalikhan
Created January 9, 2022 14:22
Show Gist options
  • Save fhdalikhan/b55e7782f29f2e9b49e5e5f45a86f29e to your computer and use it in GitHub Desktop.
Save fhdalikhan/b55e7782f29f2e9b49e5e5f45a86f29e to your computer and use it in GitHub Desktop.
recursively change folder ownership by either cron or PHP
# cron example
* * * * * /usr/bin/sudo chown -R GROUP_NAME:USER_NAME /home/fahad/upload_testing/
# php example, needs the user password and user has to have root permissons
system('echo THE_USER_PASSWORD | /usr/bin/sudo -S chown -R GROUP_NAME:USER_NAME /home/fahad/upload_testing/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment