Feature #13066

Want crontab -u

Added by Andy Fiddaman 7 months ago. Updated 6 months ago.

cmd - userland programs
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


It would be useful if the crontab command supported a -u username option to specify the username for the operation.

Without this, there is currently no easy way for root to replace a user's crontab, resulting in various tricks being employed such as:

                # Unfortunately, illumos cron does not allow for root to
                # easily replace a user's crontab, so we copy the file directly
                # into place and then edit the user's cron file with the
                # 'touch' editor a second later to cause cron to re-read.
                cp $file /var/spool/cron/crontabs/$user
                sleep 1
                env -i EDITOR=touch crontab -e $user

The -u option is also something that is common on other operating systems so adding it as a general flag will help with software portability and allow for removing workaround in various build systems (pkgsrc etc.) in the longer term.

Proposed new synopsis. Note that the three shipped copies of crontab will be updated with this change:

  • /usr/bin/crontab
  • /usr/xpg4/bin/crontab
  • /usr/xpg6/bin/crontab
       /usr/bin/crontab [-u username] [filename]

       /usr/bin/crontab { -e | -l | -r } [username]

       /usr/bin/crontab -u username { -e | -l | -r }

       /usr/xpg4/bin/crontab [filename]

       /usr/xpg4/bin/crontab { -e | -l | -r } [username]

       /usr/xpg4/bin/crontab -u username { -e | -l | -r }

       /usr/xpg6/bin/crontab [filename]

       /usr/xpg6/bin/crontab { -e | -l | -r } [username]

       /usr/xpg6/bin/crontab -u username { -e | -l | -r }

Updated by Electric Monk 7 months ago

  • Gerrit CR set to 861

Updated by Andy Fiddaman 7 months ago

Webrev also at
for an easier way to view the man page changes.


Updated by Andy Fiddaman 6 months ago

I tested this by building an updated crontab binary and then trying combinations of options to show that previous options continue to be accepted and perform the same function as previously, and that the new options work as expected in all combinations.


Updated by Andy Fiddaman 6 months ago

  • Description updated (diff)

Updated by Andy Fiddaman 6 months ago

  • Description updated (diff)

Updated by Electric Monk 6 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 6863ede29751efd2be66ec1b48c3c0ee705d7d61

commit  6863ede29751efd2be66ec1b48c3c0ee705d7d61
Author: Andy Fiddaman <>
Date:   2020-08-25T15:11:53.000Z

    13066 Want crontab -u
    Reviewed by: Peter Tribble <>
    Reviewed by: Dominik Hassler <>
    Approved by: Robert Mustacchi <>

Also available in: Atom PDF