Answers.Body: <p>I think it depends on what cron solution you are using.</p>
  <p>Since you say cv, I'll assume that you are running anacron or the like from the command line on Linux. I suggest that you run it as the user that owns the website. If you use Apache on Debian for example, the default web user is www-data.</p>
  <p>In my case, for security reasons, I make the sites owned by a user I call www-dev and so I run the Civi cron jobs as that user.
  You can access that user's crontab using sudo even if they aren't allowed to login like the www-data user: <code>sudo crontab -e -u www-dev</code>.</p>
  <p>You just need to be sure that whatever user you choose has write capabilities on the directory.</p>
  <p>As for the WP user, if you're using the command line I don't think it matters as you never provide the password on the command line. I just use my own admin account. For example I use a crontab entry like this:</p>
  <pre><code>*/5 5-22 * * *  /usr/local/bin/cv api job.execute --user=AdminUser --cwd=/var/www/wordpressroot &gt; /dev/null
  </code></pre>
  <p>I suggest you set the <code>MAILTO=</code> in the crontab file as well so you get an email if there is an error.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T13:59:36.293Z
Answers.Text: This helped me immensely -- thanks for the description and clear example!
Answers.UserDisplayName: Mark
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-01T11:50:14.367Z
Answers.LastActivityDate: 2022-11-01T12:04:40.313Z
Answers.LastEditDate: 2022-11-01T12:04:40.313Z
Answers.UserDisplayName: kapn
Answers.Body: <p>The cronuser is a CMS user, so in your case a WordPress user.  I tend to give the cron user a strong password and don't use that user account for anything but cron.  As far as permissions, they need a good deal but it depends on the jobs running.  CivICRM for WP now has the ability to create a CiviCRM administartor role (in the menu under settings  <code>/wp-admin/admin.php?page=civi_options</code>) - I'd start with that and remove unneded capabilities based on your cron/scheduled jobs.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-31T13:22:09.603Z
Answers.LastActivityDate: 2022-10-31T16:37:13.310Z
Answers.LastEditDate: 2022-10-31T16:37:13.310Z
Answers.UserDisplayName: Kevin Cristiano
Body: <p>I am working on setting up the cron job using cv on a fresh CiviCRM and WordPress install. The docs are unclear on where to set up the &quot;cronuser&quot; user (WordPress user? CiviCRM contact?) and how to set the permissions needed for the cron to run successfully.</p>
  
Tags: <wordpress><installation><cron>
Title: What's the best practice for creating a cronuser for WordPress CiviCRM installs?
ThreadText: # What's the best practice for creating a cronuser for WordPress CiviCRM installs?
  
  (Asked by: username_0 on 2022-10-30)
  
  I am working on setting up the cron job using cv on a fresh CiviCRM and WordPress install. The docs are unclear on where to set up the "cronuser" user (WordPress user? CiviCRM contact?) and how to set the permissions needed for the cron to run successfully.
  
  **Tags:** wordpress, installation, cron
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-11-01. Score: 1 | Accepted answer
  
  I think it depends on what cron solution you are using.
  
  Since you say cv, I'll assume that you are running anacron or the like from the command line on Linux. I suggest that you run it as the user that owns the website. If you use Apache on Debian for example, the default web user is www-data.
  
  In my case, for security reasons, I make the sites owned by a user I call www-dev and so I run the Civi cron jobs as that user.
  You can access that user's crontab using sudo even if they aren't allowed to login like the www-data user: `sudo crontab -e -u www-dev`.
  
  You just need to be sure that whatever user you choose has write capabilities on the directory.
  
  As for the WP user, if you're using the command line I don't think it matters as you never provide the password on the command line. I just use my own admin account. For example I use a crontab entry like this:
  
  ```
  */5 5-22 * * *  /usr/local/bin/cv api job.execute --user=AdminUser --cwd=/var/www/wordpressroot > /dev/null
  
  ```
  
  I suggest you set the `MAILTO=` in the crontab file as well so you get an email if there is an error.
  
  > **Comments:**
  > **username_0**: This helped me immensely -- thanks for the description and clear example!  
  
  ---
  
  ### Answer by username_2 on 2022-10-31. Score: 2
  
  The cronuser is a CMS user, so in your case a WordPress user. I tend to give the cron user a strong password and don't use that user account for anything but cron. As far as permissions, they need a good deal but it depends on the jobs running. CivICRM for WP now has the ability to create a CiviCRM administartor role (in the menu under settings `/wp-admin/admin.php?page=civi_options`) - I'd start with that and remove unneded capabilities based on your cron/scheduled jobs.
  
  
  ---
  
  