Skip to navigation
Cron Jobs as Other Users
21.11.22
Cron Jobs as Other Users If you are the super user then you can also modify or create the cron jobs of other users. The crontab command line option -u allows you to specify an username and edit the jobs of that user. To modify the cron jobs for user tom, use the following command. $ crontab -u tom -e The above allows you to modify the cron jobs for another user. But sometimes, you want to run a particular command as another user while still using the root or super-user crontab. You can use the su or sudo command to do that. While creating the job prefix the command with sudo -u or su
-c . 1 2 * * * su username -c "/path/to/my/scriptfile.sh" 1 2 * * * sudo -u username "/path/to/my/scriptfile.sh"
https://www.lostsaloon.com/technology/how-to-run-cron-jobs-as-a-specific-user/
Reply
Anonymous
Information Epoch 1770385996
Save trees.
Home
Notebook
Contact us