I'm trying to deny crontab to group but I had no success so far.

Nor I saw how to do it, or even discussions about it.

Is it possible to deny crontab to groups instead of users?

Imagine if you have 10 users, and want to deny access to 7. As far as I can tell, there is only two options. deny 7 or allow 3. the same applies if you have 100 000 users and want to deny 70 000. either you deny 70 000 or allow 30 000.

this is not practical at all and I believe that should be some kind of workaround.

  • this is a workaround on Debian superuser.com/q/1078301/370509, but as mentioned it's only Debian specific to have such ability, but I think there should be a way that it's out of my knowledge to know that or answer. maybe some wizard here can answer. – αғsнιη Apr 22 at 14:32
  • 1
    It's a common configuration that only users in the crontab group are allowed to use cron. In such a configuration, the 3 users you want to have access would be members of that group, and the other 10 would not be members of that group. Does your configuration not support this approach? In general, group membership enables you do do things; it doesn't prevent you from doing things. – Andy Dalton Apr 22 at 14:38
  • 1
    Can you simply turn your group into a list of users for the /etc/cron.d/cron.deny file? Example: line=$(getent group grouptodeny); echo ${line##*:} | sed 's/,/\n/g' > /etc/cront.d/cron.deny – Jeff H. Apr 22 at 14:40
  • Hi @AndyDalton, In my configuration that approach doesnt work cause the deny/allow cron files doesnt recognize groups – Nelssen Apr 25 at 18:24
  • Hi @JeffH., thank you for your workaround, I've tested and it correctly gives what I expect. But isn't there an official way of doing this using groups directly? – Nelssen Apr 25 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.