thafaker.crabdance.com

Welcome to my vintage Webserver with ftp; Files and Stuff for ms-dos, c64, amiga, howtos, classic mac

Crontab as another user

Date: [6th Aug 2024]
Categories: [howto]

Sometimes it is very important to log in to your Unix as a special user or system account for a command for a variety of reasons. I have this sometimes when I want to run cron jobs as the web server user, for example to clear caches.

To login as user www-data in Ubuntu to use crontab for managing cronjobs, just type in:

sudo crontab -u www-data -e

The following command does the same:

sudo su -c "crontab -e" www-data -s /bin/bash