Cron job help - changing file and directory permissions

Hey There!

I currently have a job running on a remote server that transfers over some backups to this server, running Debian Linux 10.

I then created a scheduled cron job to run after this is completed to change the file/directory owner & permissions but am struggling to get it to work correctly.

Backups are sent to /path-to-destination/[folder named with current date]/

I need the directories that are within this path to be 755, and all files within each directory to be 644. How can I structure my cron command to accomplish that?

Thank you for the help!

Hey there-

I was able to figure this out, so I figured that I would post my solution here for others.

I created a scheduled cron job that executes the following command:

chmod 755 $(find /PATH-TO-DIR/ -type d); chmod 644 $(find /PATH-TO-DIR/ -type f)

Hopefully, this ends up helping someone else out in the future!

  • Nate
1 Like

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.