How do I run a cron job as a specific user in Linux?
1 Answer. Or more simply, you could just run crontab -e when logged in as that user. Alternatively, you could prefix your command in your (root) crontab with sudo -u to run the command as the specified user.
How do I assign a cron job to a user?
How to Create or Edit a crontab File
- Create a new crontab file, or edit an existing file. $ crontab -e [ username ]
- Add command lines to the crontab file. Follow the syntax described in Syntax of crontab File Entries.
- Verify your crontab file changes. # crontab -l [ username ]
Does cron run as root or user?

The root user crontab Like any other user, root has a user crontab. Essentially the same as any other user crontab, you are editing the root crontab when you run sudo crontab -e . Jobs scheduled in the root user crontab will be executed as root with all of its privileges.
What user does cron run under?
root
2 Answers. Show activity on this post. They all run as root . If you need otherwise, use su in the script or add a crontab entry to the user’s crontab ( man crontab ) or the system-wide crontab (whose location I couldn’t tell you on CentOS).
Is there a way to start a cron job manually?
– Log into your server via SSH using the Shell user you wish to create the cron job under. – Once logged in, run the following command to open your crontab file. – You are then asked to choose an editor to view this file. #6 uses the program nano which is the easiest option. – A blank crontab file opens. Add the code for your cron job. – Save the file.

How to check if Cron is running?
Methods to check if crontab is working or not. The following two methods can be used to check if crontab is working or not.
How to run PHP script as normal user with cron?
Timing – set the minutes,hours,days,months,and weekday.
What is preventing my cron job from running?
To run a cron job at every minute,the format should be like below.