0

I have a QNAP NAS running Google Drive sync so that my QNAP, Computers and Google Drive are all in Sync.

When I create a file on my work computer and get home to the QNAP I get an access denied error on the file I created at work.

If I view the permissions I can see they are set incorrectly. From the QNAP web manager I simply right click the folder containing my files and set permissions to "Reapply and apply to subfolders/files".

How would one go about doing the above via a cron job that runs say every 5 minutes?

xxkinetikxx
  • 29
  • 1
  • 7

1 Answers1

1

I had a similar problem myself and also made a cron job for it.

start of with making a script in a easy to find place. I used "/share/MD0_DATA/" because all the shares live here.

Create a file like perms.sh and add the following:

#!/bin/bash
cd /share/MD0_DATA/(folder you want to apply this)
chmod -R 775 *
chown -R nobody:nogroup *

I used the nobody:nogroup just for example you can use any user and group you want.

Now you need to add this script to crontab. To see whats in your crontab use:

crontab -l

to edit the crontab use:

crontab -e

This editor works like vi if you don't like vi and want to access the file directly edit:

/etc/config/crontab

Add this line to your crontab:

*/5 * * * * /share/MD0_DATA/perms.sh

The 5 represents a 5 minute interval. Then you need to let crontab know about the new commands:

crontab /etc/config/crontab

I hope this helped you.