I have a simple sftp server to exchange files with friends. Whenever someone drops file into it, they're the sole owner of that file and I cannot delete it without using sudo, so I want to run a simple cron job to change all permissions every 5 minutes.

So I start with

sudo crontab -e

then at the very bottom of the file I add the following

5 * * * * /bin/chown myself:sftp_users -R /mnt/sftp/files/

I expect the folder owner to be changed to myself:sftp_users every 5 minutes, unfortunately no matter how long I want, nothing happens.

It's probably something silly, but what am I doing wrong?

I'm running Ubuntu Server 20.04 LTS

  • ext4 and mounted through fstab file. If I run /bin/chown myself:sftp_users -R /mnt/sftp/files/ logged in as myself it works as intended – ProTofik May 31 '20 at 1:14

The time specification

5 * * * *

runs once per hour, at 5 minutes past the hour. To run every five minutes, you would need

*/5 * * * *

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.