Can we disable cron services in desktop?What is the 'popularity-contest' package for?Cron reinstallationRunning CRON job on Ubuntu server for SugarCRMRemoving Prior Crontabscron can not start workraveCan't reboot ubuntu 18.04 using cron job

Does using "gleich" in a question add or remove politeness?

An historical mystery : Poincaré’s silence on Lebesgue integral and measure theory?

Do rainbows show spectral lines from the sun?

Implement the Max-Pooling operation from Convolutional Neural Networks

Are banter blitz players who draw arrows on the board during the game breaking the FIDE Laws of Chess?

SD Card speed degrading and doesn't work on one of my cameras: can I do something?

Why do airports in the UK have so few runways?

MS in Mathematics, having trouble finding work outside teaching algebra

Does a symmetric positive definite matrix also have A = L^T * L, (L is lower triangular matrix)?

Why does Smaug have 4 legs in the 1st movie but only 2 legs in the 2nd?

What is the purpose of this single box found in Rome B&B room?

Is it sportsmanlike to waste opponents' time by giving check at the end of the game?

Effects of quantum computing on parallel universes

What is the role of Shutter Speed while using a Manual Flash?

Fantasy story about a knife that can cut holes to other dimensions

Is it unsafe to remove one stud from a load bearing wall?

Anatomically correct banshee

Improving the observation skill & making less blunders

How to write a bootable ISO Windows installation disk to a disk partition (and not USB flash drive)?

Das ist ja wohl nicht dein Ernst - meaning of particle "ja"

Is it a good idea to contact a candidate?

Is a vector space naturally isomorphic to its dual?

Calculate the sum of interior angles of a polygon

How to avoid answering "what were you sick with"?



Can we disable cron services in desktop?


What is the 'popularity-contest' package for?Cron reinstallationRunning CRON job on Ubuntu server for SugarCRMRemoving Prior Crontabscron can not start workraveCan't reboot ubuntu 18.04 using cron job






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









2

















I was reading about EvilGnome and how it hijacks a system. One of the interesting thing I read was how it uses crontab




The Linux implant also gains persistence on a targeted system using
crontab, similar to windows task scheduler, and sends stolen user data
to a remote attacker-controlled server.




In my ubuntu desktop I myself doesn't have any custom cron jobs but when I did service cron status it returned some results.



systemd[1]: Started Regular background program processing daemon. 
cron[916]: (CRON) INFO (pidfile fd = 3)
cron[916]: (CRON) INFO (Running @reboot jobs)
CRON[19931]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[19932]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
CRON[19931]: pam_unix(cron:session): session closed for user root


My question is can I disable cron jobs something like sudo systemctl disable cron.service? Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?










share|improve this question


























  • "EvilGnome malware masquerades itself as a legit GNOME extension, a program that lets Linux users extend the functionality of their desktops." I would advice against using any extension to start with. It was a bad design decision to start forcing extensions by GNOME developers to begin with.

    – Rinzwind
    Jul 17 at 17:49

















2

















I was reading about EvilGnome and how it hijacks a system. One of the interesting thing I read was how it uses crontab




The Linux implant also gains persistence on a targeted system using
crontab, similar to windows task scheduler, and sends stolen user data
to a remote attacker-controlled server.




In my ubuntu desktop I myself doesn't have any custom cron jobs but when I did service cron status it returned some results.



systemd[1]: Started Regular background program processing daemon. 
cron[916]: (CRON) INFO (pidfile fd = 3)
cron[916]: (CRON) INFO (Running @reboot jobs)
CRON[19931]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[19932]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
CRON[19931]: pam_unix(cron:session): session closed for user root


My question is can I disable cron jobs something like sudo systemctl disable cron.service? Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?










share|improve this question


























  • "EvilGnome malware masquerades itself as a legit GNOME extension, a program that lets Linux users extend the functionality of their desktops." I would advice against using any extension to start with. It was a bad design decision to start forcing extensions by GNOME developers to begin with.

    – Rinzwind
    Jul 17 at 17:49













2












2








2








I was reading about EvilGnome and how it hijacks a system. One of the interesting thing I read was how it uses crontab




The Linux implant also gains persistence on a targeted system using
crontab, similar to windows task scheduler, and sends stolen user data
to a remote attacker-controlled server.




In my ubuntu desktop I myself doesn't have any custom cron jobs but when I did service cron status it returned some results.



systemd[1]: Started Regular background program processing daemon. 
cron[916]: (CRON) INFO (pidfile fd = 3)
cron[916]: (CRON) INFO (Running @reboot jobs)
CRON[19931]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[19932]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
CRON[19931]: pam_unix(cron:session): session closed for user root


My question is can I disable cron jobs something like sudo systemctl disable cron.service? Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?










share|improve this question















I was reading about EvilGnome and how it hijacks a system. One of the interesting thing I read was how it uses crontab




The Linux implant also gains persistence on a targeted system using
crontab, similar to windows task scheduler, and sends stolen user data
to a remote attacker-controlled server.




In my ubuntu desktop I myself doesn't have any custom cron jobs but when I did service cron status it returned some results.



systemd[1]: Started Regular background program processing daemon. 
cron[916]: (CRON) INFO (pidfile fd = 3)
cron[916]: (CRON) INFO (Running @reboot jobs)
CRON[19931]: pam_unix(cron:session): session opened for user root by (uid=0)
CRON[19932]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
CRON[19931]: pam_unix(cron:session): session closed for user root


My question is can I disable cron jobs something like sudo systemctl disable cron.service? Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?







16.04 18.04 security cron malware






share|improve this question














share|improve this question











share|improve this question




share|improve this question










asked Jul 17 at 17:02









EkaEka

1,1706 gold badges23 silver badges43 bronze badges




1,1706 gold badges23 silver badges43 bronze badges















  • "EvilGnome malware masquerades itself as a legit GNOME extension, a program that lets Linux users extend the functionality of their desktops." I would advice against using any extension to start with. It was a bad design decision to start forcing extensions by GNOME developers to begin with.

    – Rinzwind
    Jul 17 at 17:49

















  • "EvilGnome malware masquerades itself as a legit GNOME extension, a program that lets Linux users extend the functionality of their desktops." I would advice against using any extension to start with. It was a bad design decision to start forcing extensions by GNOME developers to begin with.

    – Rinzwind
    Jul 17 at 17:49
















"EvilGnome malware masquerades itself as a legit GNOME extension, a program that lets Linux users extend the functionality of their desktops." I would advice against using any extension to start with. It was a bad design decision to start forcing extensions by GNOME developers to begin with.

– Rinzwind
Jul 17 at 17:49





"EvilGnome malware masquerades itself as a legit GNOME extension, a program that lets Linux users extend the functionality of their desktops." I would advice against using any extension to start with. It was a bad design decision to start forcing extensions by GNOME developers to begin with.

– Rinzwind
Jul 17 at 17:49










2 Answers
2






active

oldest

votes


















2


















Yes. BUT there are a couple of tasks active on our systems and those will stop too.




Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?




I would suggest it is necessary but as always with Linux ... your choice to decide :) Might I suggest another method: why not flag changes to /etc/cron*/, /etc/crontab and /var/spool/cron/crontabs//? That might be a lot less trouble as you get to keep the normal cron jobs active. Just need to create a watchdog and set it loose on those directories.



A run down on cron from my system (yours might have more, the same or less actions) ...



$ ls /etc/cron.daily/
0anacron cracklib-runtime man-db samba
apport dpkg mlocate update-notifier-common
apt-compat google-chrome passwd
bsdmainutils logrotate popularity-contest


$ ls /etc/cron.weekly/
0anacron man-db update-notifier-common

$ ls /etc/cron.monthly/
0anacron


So generally I would investigate any of these (like popularity-contest is all fine and dandy but I could live without it). mlocate might be an issue: that one updates the locate command so could be useful. And so on. EACH of these you could run manually.



Each of the files will have an explanation:



rinzwind@schijfwereld:~$ more /etc/cron.monthly/0anacron 
#!/bin/sh
#
# anacron's cron script
#
# This script updates anacron time stamps. It is called through run-parts
# either by anacron itself or by cron.
#
# The script is called "0anacron" to assure that it will be executed
# _before_ all other scripts.

test -x /usr/sbin/anacron || exit 0
anacron -u cron.monthly


anacron has its own service:



$ systemctl list-unit-files | grep cron
anacron.service enabled
cron.service enabled
anacron.timer enabled


Now for the command (stop and start):



sudo systemctl stop crond.service
sudo systemctl start crond.service
sudo systemctl stop anacron.service
sudo systemctl start anacron.service
sudo systemctl stop anacron.timer
sudo systemctl start anacron.timer


(I did not test each of them ;) )



Plus there is more than that: a user cron is also active; you can disable those with ...



sudo touch /var/spool/cron/crontabs/$USER
sudo chmod 0 /var/spool/cron/crontabs/$USER


for every user on your system (make copies of the files please so you can restore them if you want to restore them) (oddly I have not found a systemd service for user crons and I doubt it is dealt with from cron.service).






share|improve this answer



































    2


















    Note: This is for companies with multi-million dollar yearly operating budgets. It would take a week to setup and requires an hour or two after upgrades to audit and even more to incorporate new scripts from an upgrade.



    In comments it was mentioned logrotate gets called daily. This is an important part of Ubuntu for keeping log files down to size. If you are so concerned about cron you pull it fro mservice you would have to create your own script which mimicked cron. I'll call this script crony. You can keep it locked down in a place hackers wouldn't think to look for it.





    Let's look at the files in /etc/cron.daily:



    -rwxr-xr-x 1 root root 311 Feb 19 2014 0anacron*
    -rwxr-xr-x 1 root root 376 Apr 4 2014 apport*
    -rwxr-xr-x 1 root root 1474 Oct 31 2016 apt-compat*
    -rwxr-xr-x 1 root root 314 Nov 26 2015 aptitude*
    -rwxr-xr-x 1 root root 355 Jun 4 2013 bsdmainutils*
    -rwxr-xr-x 1 root root 384 Mar 23 2014 cracklib-runtime*
    -rwxr-xr-x 1 root root 1597 Nov 26 2015 dpkg*
    lrwxrwxrwx 1 root root 37 Jun 4 01:43 google-chrome -> /opt/google/chrome/cron/google-chrome*
    -rwxr-xr-x 1 root root 7613 Jan 17 2017 google-earth*
    -rwxr-xr-x 1 root root 13944 Mar 4 17:48 google-earth-pro*
    -rwxr-xr-x 1 root root 372 Jan 22 2014 logrotate*
    -rwxr-xr-x 1 root root 1293 Nov 6 2015 man-db*
    -rwxr-xr-x 1 root root 435 Jun 20 2013 mlocate*
    -rwxr-xr-x 1 root root 249 Feb 16 2014 passwd*
    -rw-r--r-- 1 root root 102 Feb 9 2013 .placeholder
    -rwxr-xr-x 1 root root 3449 Feb 26 2016 popularity-contest*
    -rwxr-xr-x 1 root root 383 Mar 7 2016 samba*
    -rwxr-xr-x 1 root root 214 Apr 9 2014 update-notifier-common*
    -rwxr-xr-x 1 root root 1046 May 19 2016 upstart*


    The script mlocate I don't even use daily. I have it run every 15 minutes because daily isn't enough for my liking. the script popularity-contest is kind of like spyware so I wouldn't call it with crony if I were replacing cron.



    I would call all my crony scrips from /etc/rc.local but there are other ways of doing it.



    The format would be like this:



    $ cat /etc/rc.local

    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.

    # Jan 05 2018 - Reload Logitech Unifying Receiver to get Mouse in Power Stats
    modprobe -r hid_logitech_dj
    modprobe hid_logitech_dj

    # Call crony to mimick cron's duties
    # daemonize job boot delay sleep interval
    crony /etc/cron.daily/mlocate 1m 15m &
    crony /etc/cron.daily/logrotate 30m d &
    crony /mnt/e/usr/local/bin/daily-backup 5m d &
    corny /usr/local/bin/eyesome-sun.sh 1m d &

    exit 0


    This is what a typical installation has for entries that are already setup in /etc/rc.local along with new crony entries after them. The last two of my crony entries are custom scripts my machine has in /etc/cron.daily



    #!/bin/bash

    # NAME: crony
    # PATH: /usr/local/bin
    # DATE: July 17, 2019
    # NOTE: For Ask Ubuntu: https://askubuntu.com/questions/1159014/can-we-disable-cron-services-in-desktop

    logger "$0"

    sleep "$2"

    while true; do
    "$1"
    # If if parameter 2 is "d" for 1 day interval we can't sleep for a day
    # because laptop may have been suspended. Use 10 minutes to minimize resources
    sleep 10m
    # Check if time to process job again. If not continue
    continue

    done


    crony script needs more work but you get the general idea. This may or may not be a good project for WSL (Windows Subsystem for Linux) in which case I may finish it.






    share|improve this answer




























    • Good news: In 18.04 and newer, Unattended Upgrades shifted from a cron job to a systemd timer. The cron job /etc/cron.daily/apt-compat is for folks who don't use systemd.

      – user535733
      Jul 17 at 17:31











    • logrotate could be a problem: log files not getting compressed. mlocate too. the command locate becomes useless.

      – Rinzwind
      Jul 17 at 17:42












    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1159014%2fcan-we-disable-cron-services-in-desktop%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown


























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2


















    Yes. BUT there are a couple of tasks active on our systems and those will stop too.




    Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?




    I would suggest it is necessary but as always with Linux ... your choice to decide :) Might I suggest another method: why not flag changes to /etc/cron*/, /etc/crontab and /var/spool/cron/crontabs//? That might be a lot less trouble as you get to keep the normal cron jobs active. Just need to create a watchdog and set it loose on those directories.



    A run down on cron from my system (yours might have more, the same or less actions) ...



    $ ls /etc/cron.daily/
    0anacron cracklib-runtime man-db samba
    apport dpkg mlocate update-notifier-common
    apt-compat google-chrome passwd
    bsdmainutils logrotate popularity-contest


    $ ls /etc/cron.weekly/
    0anacron man-db update-notifier-common

    $ ls /etc/cron.monthly/
    0anacron


    So generally I would investigate any of these (like popularity-contest is all fine and dandy but I could live without it). mlocate might be an issue: that one updates the locate command so could be useful. And so on. EACH of these you could run manually.



    Each of the files will have an explanation:



    rinzwind@schijfwereld:~$ more /etc/cron.monthly/0anacron 
    #!/bin/sh
    #
    # anacron's cron script
    #
    # This script updates anacron time stamps. It is called through run-parts
    # either by anacron itself or by cron.
    #
    # The script is called "0anacron" to assure that it will be executed
    # _before_ all other scripts.

    test -x /usr/sbin/anacron || exit 0
    anacron -u cron.monthly


    anacron has its own service:



    $ systemctl list-unit-files | grep cron
    anacron.service enabled
    cron.service enabled
    anacron.timer enabled


    Now for the command (stop and start):



    sudo systemctl stop crond.service
    sudo systemctl start crond.service
    sudo systemctl stop anacron.service
    sudo systemctl start anacron.service
    sudo systemctl stop anacron.timer
    sudo systemctl start anacron.timer


    (I did not test each of them ;) )



    Plus there is more than that: a user cron is also active; you can disable those with ...



    sudo touch /var/spool/cron/crontabs/$USER
    sudo chmod 0 /var/spool/cron/crontabs/$USER


    for every user on your system (make copies of the files please so you can restore them if you want to restore them) (oddly I have not found a systemd service for user crons and I doubt it is dealt with from cron.service).






    share|improve this answer
































      2


















      Yes. BUT there are a couple of tasks active on our systems and those will stop too.




      Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?




      I would suggest it is necessary but as always with Linux ... your choice to decide :) Might I suggest another method: why not flag changes to /etc/cron*/, /etc/crontab and /var/spool/cron/crontabs//? That might be a lot less trouble as you get to keep the normal cron jobs active. Just need to create a watchdog and set it loose on those directories.



      A run down on cron from my system (yours might have more, the same or less actions) ...



      $ ls /etc/cron.daily/
      0anacron cracklib-runtime man-db samba
      apport dpkg mlocate update-notifier-common
      apt-compat google-chrome passwd
      bsdmainutils logrotate popularity-contest


      $ ls /etc/cron.weekly/
      0anacron man-db update-notifier-common

      $ ls /etc/cron.monthly/
      0anacron


      So generally I would investigate any of these (like popularity-contest is all fine and dandy but I could live without it). mlocate might be an issue: that one updates the locate command so could be useful. And so on. EACH of these you could run manually.



      Each of the files will have an explanation:



      rinzwind@schijfwereld:~$ more /etc/cron.monthly/0anacron 
      #!/bin/sh
      #
      # anacron's cron script
      #
      # This script updates anacron time stamps. It is called through run-parts
      # either by anacron itself or by cron.
      #
      # The script is called "0anacron" to assure that it will be executed
      # _before_ all other scripts.

      test -x /usr/sbin/anacron || exit 0
      anacron -u cron.monthly


      anacron has its own service:



      $ systemctl list-unit-files | grep cron
      anacron.service enabled
      cron.service enabled
      anacron.timer enabled


      Now for the command (stop and start):



      sudo systemctl stop crond.service
      sudo systemctl start crond.service
      sudo systemctl stop anacron.service
      sudo systemctl start anacron.service
      sudo systemctl stop anacron.timer
      sudo systemctl start anacron.timer


      (I did not test each of them ;) )



      Plus there is more than that: a user cron is also active; you can disable those with ...



      sudo touch /var/spool/cron/crontabs/$USER
      sudo chmod 0 /var/spool/cron/crontabs/$USER


      for every user on your system (make copies of the files please so you can restore them if you want to restore them) (oddly I have not found a systemd service for user crons and I doubt it is dealt with from cron.service).






      share|improve this answer






























        2














        2










        2









        Yes. BUT there are a couple of tasks active on our systems and those will stop too.




        Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?




        I would suggest it is necessary but as always with Linux ... your choice to decide :) Might I suggest another method: why not flag changes to /etc/cron*/, /etc/crontab and /var/spool/cron/crontabs//? That might be a lot less trouble as you get to keep the normal cron jobs active. Just need to create a watchdog and set it loose on those directories.



        A run down on cron from my system (yours might have more, the same or less actions) ...



        $ ls /etc/cron.daily/
        0anacron cracklib-runtime man-db samba
        apport dpkg mlocate update-notifier-common
        apt-compat google-chrome passwd
        bsdmainutils logrotate popularity-contest


        $ ls /etc/cron.weekly/
        0anacron man-db update-notifier-common

        $ ls /etc/cron.monthly/
        0anacron


        So generally I would investigate any of these (like popularity-contest is all fine and dandy but I could live without it). mlocate might be an issue: that one updates the locate command so could be useful. And so on. EACH of these you could run manually.



        Each of the files will have an explanation:



        rinzwind@schijfwereld:~$ more /etc/cron.monthly/0anacron 
        #!/bin/sh
        #
        # anacron's cron script
        #
        # This script updates anacron time stamps. It is called through run-parts
        # either by anacron itself or by cron.
        #
        # The script is called "0anacron" to assure that it will be executed
        # _before_ all other scripts.

        test -x /usr/sbin/anacron || exit 0
        anacron -u cron.monthly


        anacron has its own service:



        $ systemctl list-unit-files | grep cron
        anacron.service enabled
        cron.service enabled
        anacron.timer enabled


        Now for the command (stop and start):



        sudo systemctl stop crond.service
        sudo systemctl start crond.service
        sudo systemctl stop anacron.service
        sudo systemctl start anacron.service
        sudo systemctl stop anacron.timer
        sudo systemctl start anacron.timer


        (I did not test each of them ;) )



        Plus there is more than that: a user cron is also active; you can disable those with ...



        sudo touch /var/spool/cron/crontabs/$USER
        sudo chmod 0 /var/spool/cron/crontabs/$USER


        for every user on your system (make copies of the files please so you can restore them if you want to restore them) (oddly I have not found a systemd service for user crons and I doubt it is dealt with from cron.service).






        share|improve this answer
















        Yes. BUT there are a couple of tasks active on our systems and those will stop too.




        Is cron a necessary service for a ubuntu desktop or can I completely remove this from my system?




        I would suggest it is necessary but as always with Linux ... your choice to decide :) Might I suggest another method: why not flag changes to /etc/cron*/, /etc/crontab and /var/spool/cron/crontabs//? That might be a lot less trouble as you get to keep the normal cron jobs active. Just need to create a watchdog and set it loose on those directories.



        A run down on cron from my system (yours might have more, the same or less actions) ...



        $ ls /etc/cron.daily/
        0anacron cracklib-runtime man-db samba
        apport dpkg mlocate update-notifier-common
        apt-compat google-chrome passwd
        bsdmainutils logrotate popularity-contest


        $ ls /etc/cron.weekly/
        0anacron man-db update-notifier-common

        $ ls /etc/cron.monthly/
        0anacron


        So generally I would investigate any of these (like popularity-contest is all fine and dandy but I could live without it). mlocate might be an issue: that one updates the locate command so could be useful. And so on. EACH of these you could run manually.



        Each of the files will have an explanation:



        rinzwind@schijfwereld:~$ more /etc/cron.monthly/0anacron 
        #!/bin/sh
        #
        # anacron's cron script
        #
        # This script updates anacron time stamps. It is called through run-parts
        # either by anacron itself or by cron.
        #
        # The script is called "0anacron" to assure that it will be executed
        # _before_ all other scripts.

        test -x /usr/sbin/anacron || exit 0
        anacron -u cron.monthly


        anacron has its own service:



        $ systemctl list-unit-files | grep cron
        anacron.service enabled
        cron.service enabled
        anacron.timer enabled


        Now for the command (stop and start):



        sudo systemctl stop crond.service
        sudo systemctl start crond.service
        sudo systemctl stop anacron.service
        sudo systemctl start anacron.service
        sudo systemctl stop anacron.timer
        sudo systemctl start anacron.timer


        (I did not test each of them ;) )



        Plus there is more than that: a user cron is also active; you can disable those with ...



        sudo touch /var/spool/cron/crontabs/$USER
        sudo chmod 0 /var/spool/cron/crontabs/$USER


        for every user on your system (make copies of the files please so you can restore them if you want to restore them) (oddly I have not found a systemd service for user crons and I doubt it is dealt with from cron.service).







        share|improve this answer















        share|improve this answer




        share|improve this answer








        edited Jul 17 at 17:48

























        answered Jul 17 at 17:28









        RinzwindRinzwind

        225k30 gold badges435 silver badges577 bronze badges




        225k30 gold badges435 silver badges577 bronze badges


























            2


















            Note: This is for companies with multi-million dollar yearly operating budgets. It would take a week to setup and requires an hour or two after upgrades to audit and even more to incorporate new scripts from an upgrade.



            In comments it was mentioned logrotate gets called daily. This is an important part of Ubuntu for keeping log files down to size. If you are so concerned about cron you pull it fro mservice you would have to create your own script which mimicked cron. I'll call this script crony. You can keep it locked down in a place hackers wouldn't think to look for it.





            Let's look at the files in /etc/cron.daily:



            -rwxr-xr-x 1 root root 311 Feb 19 2014 0anacron*
            -rwxr-xr-x 1 root root 376 Apr 4 2014 apport*
            -rwxr-xr-x 1 root root 1474 Oct 31 2016 apt-compat*
            -rwxr-xr-x 1 root root 314 Nov 26 2015 aptitude*
            -rwxr-xr-x 1 root root 355 Jun 4 2013 bsdmainutils*
            -rwxr-xr-x 1 root root 384 Mar 23 2014 cracklib-runtime*
            -rwxr-xr-x 1 root root 1597 Nov 26 2015 dpkg*
            lrwxrwxrwx 1 root root 37 Jun 4 01:43 google-chrome -> /opt/google/chrome/cron/google-chrome*
            -rwxr-xr-x 1 root root 7613 Jan 17 2017 google-earth*
            -rwxr-xr-x 1 root root 13944 Mar 4 17:48 google-earth-pro*
            -rwxr-xr-x 1 root root 372 Jan 22 2014 logrotate*
            -rwxr-xr-x 1 root root 1293 Nov 6 2015 man-db*
            -rwxr-xr-x 1 root root 435 Jun 20 2013 mlocate*
            -rwxr-xr-x 1 root root 249 Feb 16 2014 passwd*
            -rw-r--r-- 1 root root 102 Feb 9 2013 .placeholder
            -rwxr-xr-x 1 root root 3449 Feb 26 2016 popularity-contest*
            -rwxr-xr-x 1 root root 383 Mar 7 2016 samba*
            -rwxr-xr-x 1 root root 214 Apr 9 2014 update-notifier-common*
            -rwxr-xr-x 1 root root 1046 May 19 2016 upstart*


            The script mlocate I don't even use daily. I have it run every 15 minutes because daily isn't enough for my liking. the script popularity-contest is kind of like spyware so I wouldn't call it with crony if I were replacing cron.



            I would call all my crony scrips from /etc/rc.local but there are other ways of doing it.



            The format would be like this:



            $ cat /etc/rc.local

            #!/bin/sh -e
            #
            # rc.local
            #
            # This script is executed at the end of each multiuser runlevel.
            # Make sure that the script will "exit 0" on success or any other
            # value on error.
            #
            # In order to enable or disable this script just change the execution
            # bits.
            #
            # By default this script does nothing.

            # Jan 05 2018 - Reload Logitech Unifying Receiver to get Mouse in Power Stats
            modprobe -r hid_logitech_dj
            modprobe hid_logitech_dj

            # Call crony to mimick cron's duties
            # daemonize job boot delay sleep interval
            crony /etc/cron.daily/mlocate 1m 15m &
            crony /etc/cron.daily/logrotate 30m d &
            crony /mnt/e/usr/local/bin/daily-backup 5m d &
            corny /usr/local/bin/eyesome-sun.sh 1m d &

            exit 0


            This is what a typical installation has for entries that are already setup in /etc/rc.local along with new crony entries after them. The last two of my crony entries are custom scripts my machine has in /etc/cron.daily



            #!/bin/bash

            # NAME: crony
            # PATH: /usr/local/bin
            # DATE: July 17, 2019
            # NOTE: For Ask Ubuntu: https://askubuntu.com/questions/1159014/can-we-disable-cron-services-in-desktop

            logger "$0"

            sleep "$2"

            while true; do
            "$1"
            # If if parameter 2 is "d" for 1 day interval we can't sleep for a day
            # because laptop may have been suspended. Use 10 minutes to minimize resources
            sleep 10m
            # Check if time to process job again. If not continue
            continue

            done


            crony script needs more work but you get the general idea. This may or may not be a good project for WSL (Windows Subsystem for Linux) in which case I may finish it.






            share|improve this answer




























            • Good news: In 18.04 and newer, Unattended Upgrades shifted from a cron job to a systemd timer. The cron job /etc/cron.daily/apt-compat is for folks who don't use systemd.

              – user535733
              Jul 17 at 17:31











            • logrotate could be a problem: log files not getting compressed. mlocate too. the command locate becomes useless.

              – Rinzwind
              Jul 17 at 17:42















            2


















            Note: This is for companies with multi-million dollar yearly operating budgets. It would take a week to setup and requires an hour or two after upgrades to audit and even more to incorporate new scripts from an upgrade.



            In comments it was mentioned logrotate gets called daily. This is an important part of Ubuntu for keeping log files down to size. If you are so concerned about cron you pull it fro mservice you would have to create your own script which mimicked cron. I'll call this script crony. You can keep it locked down in a place hackers wouldn't think to look for it.





            Let's look at the files in /etc/cron.daily:



            -rwxr-xr-x 1 root root 311 Feb 19 2014 0anacron*
            -rwxr-xr-x 1 root root 376 Apr 4 2014 apport*
            -rwxr-xr-x 1 root root 1474 Oct 31 2016 apt-compat*
            -rwxr-xr-x 1 root root 314 Nov 26 2015 aptitude*
            -rwxr-xr-x 1 root root 355 Jun 4 2013 bsdmainutils*
            -rwxr-xr-x 1 root root 384 Mar 23 2014 cracklib-runtime*
            -rwxr-xr-x 1 root root 1597 Nov 26 2015 dpkg*
            lrwxrwxrwx 1 root root 37 Jun 4 01:43 google-chrome -> /opt/google/chrome/cron/google-chrome*
            -rwxr-xr-x 1 root root 7613 Jan 17 2017 google-earth*
            -rwxr-xr-x 1 root root 13944 Mar 4 17:48 google-earth-pro*
            -rwxr-xr-x 1 root root 372 Jan 22 2014 logrotate*
            -rwxr-xr-x 1 root root 1293 Nov 6 2015 man-db*
            -rwxr-xr-x 1 root root 435 Jun 20 2013 mlocate*
            -rwxr-xr-x 1 root root 249 Feb 16 2014 passwd*
            -rw-r--r-- 1 root root 102 Feb 9 2013 .placeholder
            -rwxr-xr-x 1 root root 3449 Feb 26 2016 popularity-contest*
            -rwxr-xr-x 1 root root 383 Mar 7 2016 samba*
            -rwxr-xr-x 1 root root 214 Apr 9 2014 update-notifier-common*
            -rwxr-xr-x 1 root root 1046 May 19 2016 upstart*


            The script mlocate I don't even use daily. I have it run every 15 minutes because daily isn't enough for my liking. the script popularity-contest is kind of like spyware so I wouldn't call it with crony if I were replacing cron.



            I would call all my crony scrips from /etc/rc.local but there are other ways of doing it.



            The format would be like this:



            $ cat /etc/rc.local

            #!/bin/sh -e
            #
            # rc.local
            #
            # This script is executed at the end of each multiuser runlevel.
            # Make sure that the script will "exit 0" on success or any other
            # value on error.
            #
            # In order to enable or disable this script just change the execution
            # bits.
            #
            # By default this script does nothing.

            # Jan 05 2018 - Reload Logitech Unifying Receiver to get Mouse in Power Stats
            modprobe -r hid_logitech_dj
            modprobe hid_logitech_dj

            # Call crony to mimick cron's duties
            # daemonize job boot delay sleep interval
            crony /etc/cron.daily/mlocate 1m 15m &
            crony /etc/cron.daily/logrotate 30m d &
            crony /mnt/e/usr/local/bin/daily-backup 5m d &
            corny /usr/local/bin/eyesome-sun.sh 1m d &

            exit 0


            This is what a typical installation has for entries that are already setup in /etc/rc.local along with new crony entries after them. The last two of my crony entries are custom scripts my machine has in /etc/cron.daily



            #!/bin/bash

            # NAME: crony
            # PATH: /usr/local/bin
            # DATE: July 17, 2019
            # NOTE: For Ask Ubuntu: https://askubuntu.com/questions/1159014/can-we-disable-cron-services-in-desktop

            logger "$0"

            sleep "$2"

            while true; do
            "$1"
            # If if parameter 2 is "d" for 1 day interval we can't sleep for a day
            # because laptop may have been suspended. Use 10 minutes to minimize resources
            sleep 10m
            # Check if time to process job again. If not continue
            continue

            done


            crony script needs more work but you get the general idea. This may or may not be a good project for WSL (Windows Subsystem for Linux) in which case I may finish it.






            share|improve this answer




























            • Good news: In 18.04 and newer, Unattended Upgrades shifted from a cron job to a systemd timer. The cron job /etc/cron.daily/apt-compat is for folks who don't use systemd.

              – user535733
              Jul 17 at 17:31











            • logrotate could be a problem: log files not getting compressed. mlocate too. the command locate becomes useless.

              – Rinzwind
              Jul 17 at 17:42













            2














            2










            2









            Note: This is for companies with multi-million dollar yearly operating budgets. It would take a week to setup and requires an hour or two after upgrades to audit and even more to incorporate new scripts from an upgrade.



            In comments it was mentioned logrotate gets called daily. This is an important part of Ubuntu for keeping log files down to size. If you are so concerned about cron you pull it fro mservice you would have to create your own script which mimicked cron. I'll call this script crony. You can keep it locked down in a place hackers wouldn't think to look for it.





            Let's look at the files in /etc/cron.daily:



            -rwxr-xr-x 1 root root 311 Feb 19 2014 0anacron*
            -rwxr-xr-x 1 root root 376 Apr 4 2014 apport*
            -rwxr-xr-x 1 root root 1474 Oct 31 2016 apt-compat*
            -rwxr-xr-x 1 root root 314 Nov 26 2015 aptitude*
            -rwxr-xr-x 1 root root 355 Jun 4 2013 bsdmainutils*
            -rwxr-xr-x 1 root root 384 Mar 23 2014 cracklib-runtime*
            -rwxr-xr-x 1 root root 1597 Nov 26 2015 dpkg*
            lrwxrwxrwx 1 root root 37 Jun 4 01:43 google-chrome -> /opt/google/chrome/cron/google-chrome*
            -rwxr-xr-x 1 root root 7613 Jan 17 2017 google-earth*
            -rwxr-xr-x 1 root root 13944 Mar 4 17:48 google-earth-pro*
            -rwxr-xr-x 1 root root 372 Jan 22 2014 logrotate*
            -rwxr-xr-x 1 root root 1293 Nov 6 2015 man-db*
            -rwxr-xr-x 1 root root 435 Jun 20 2013 mlocate*
            -rwxr-xr-x 1 root root 249 Feb 16 2014 passwd*
            -rw-r--r-- 1 root root 102 Feb 9 2013 .placeholder
            -rwxr-xr-x 1 root root 3449 Feb 26 2016 popularity-contest*
            -rwxr-xr-x 1 root root 383 Mar 7 2016 samba*
            -rwxr-xr-x 1 root root 214 Apr 9 2014 update-notifier-common*
            -rwxr-xr-x 1 root root 1046 May 19 2016 upstart*


            The script mlocate I don't even use daily. I have it run every 15 minutes because daily isn't enough for my liking. the script popularity-contest is kind of like spyware so I wouldn't call it with crony if I were replacing cron.



            I would call all my crony scrips from /etc/rc.local but there are other ways of doing it.



            The format would be like this:



            $ cat /etc/rc.local

            #!/bin/sh -e
            #
            # rc.local
            #
            # This script is executed at the end of each multiuser runlevel.
            # Make sure that the script will "exit 0" on success or any other
            # value on error.
            #
            # In order to enable or disable this script just change the execution
            # bits.
            #
            # By default this script does nothing.

            # Jan 05 2018 - Reload Logitech Unifying Receiver to get Mouse in Power Stats
            modprobe -r hid_logitech_dj
            modprobe hid_logitech_dj

            # Call crony to mimick cron's duties
            # daemonize job boot delay sleep interval
            crony /etc/cron.daily/mlocate 1m 15m &
            crony /etc/cron.daily/logrotate 30m d &
            crony /mnt/e/usr/local/bin/daily-backup 5m d &
            corny /usr/local/bin/eyesome-sun.sh 1m d &

            exit 0


            This is what a typical installation has for entries that are already setup in /etc/rc.local along with new crony entries after them. The last two of my crony entries are custom scripts my machine has in /etc/cron.daily



            #!/bin/bash

            # NAME: crony
            # PATH: /usr/local/bin
            # DATE: July 17, 2019
            # NOTE: For Ask Ubuntu: https://askubuntu.com/questions/1159014/can-we-disable-cron-services-in-desktop

            logger "$0"

            sleep "$2"

            while true; do
            "$1"
            # If if parameter 2 is "d" for 1 day interval we can't sleep for a day
            # because laptop may have been suspended. Use 10 minutes to minimize resources
            sleep 10m
            # Check if time to process job again. If not continue
            continue

            done


            crony script needs more work but you get the general idea. This may or may not be a good project for WSL (Windows Subsystem for Linux) in which case I may finish it.






            share|improve this answer
















            Note: This is for companies with multi-million dollar yearly operating budgets. It would take a week to setup and requires an hour or two after upgrades to audit and even more to incorporate new scripts from an upgrade.



            In comments it was mentioned logrotate gets called daily. This is an important part of Ubuntu for keeping log files down to size. If you are so concerned about cron you pull it fro mservice you would have to create your own script which mimicked cron. I'll call this script crony. You can keep it locked down in a place hackers wouldn't think to look for it.





            Let's look at the files in /etc/cron.daily:



            -rwxr-xr-x 1 root root 311 Feb 19 2014 0anacron*
            -rwxr-xr-x 1 root root 376 Apr 4 2014 apport*
            -rwxr-xr-x 1 root root 1474 Oct 31 2016 apt-compat*
            -rwxr-xr-x 1 root root 314 Nov 26 2015 aptitude*
            -rwxr-xr-x 1 root root 355 Jun 4 2013 bsdmainutils*
            -rwxr-xr-x 1 root root 384 Mar 23 2014 cracklib-runtime*
            -rwxr-xr-x 1 root root 1597 Nov 26 2015 dpkg*
            lrwxrwxrwx 1 root root 37 Jun 4 01:43 google-chrome -> /opt/google/chrome/cron/google-chrome*
            -rwxr-xr-x 1 root root 7613 Jan 17 2017 google-earth*
            -rwxr-xr-x 1 root root 13944 Mar 4 17:48 google-earth-pro*
            -rwxr-xr-x 1 root root 372 Jan 22 2014 logrotate*
            -rwxr-xr-x 1 root root 1293 Nov 6 2015 man-db*
            -rwxr-xr-x 1 root root 435 Jun 20 2013 mlocate*
            -rwxr-xr-x 1 root root 249 Feb 16 2014 passwd*
            -rw-r--r-- 1 root root 102 Feb 9 2013 .placeholder
            -rwxr-xr-x 1 root root 3449 Feb 26 2016 popularity-contest*
            -rwxr-xr-x 1 root root 383 Mar 7 2016 samba*
            -rwxr-xr-x 1 root root 214 Apr 9 2014 update-notifier-common*
            -rwxr-xr-x 1 root root 1046 May 19 2016 upstart*


            The script mlocate I don't even use daily. I have it run every 15 minutes because daily isn't enough for my liking. the script popularity-contest is kind of like spyware so I wouldn't call it with crony if I were replacing cron.



            I would call all my crony scrips from /etc/rc.local but there are other ways of doing it.



            The format would be like this:



            $ cat /etc/rc.local

            #!/bin/sh -e
            #
            # rc.local
            #
            # This script is executed at the end of each multiuser runlevel.
            # Make sure that the script will "exit 0" on success or any other
            # value on error.
            #
            # In order to enable or disable this script just change the execution
            # bits.
            #
            # By default this script does nothing.

            # Jan 05 2018 - Reload Logitech Unifying Receiver to get Mouse in Power Stats
            modprobe -r hid_logitech_dj
            modprobe hid_logitech_dj

            # Call crony to mimick cron's duties
            # daemonize job boot delay sleep interval
            crony /etc/cron.daily/mlocate 1m 15m &
            crony /etc/cron.daily/logrotate 30m d &
            crony /mnt/e/usr/local/bin/daily-backup 5m d &
            corny /usr/local/bin/eyesome-sun.sh 1m d &

            exit 0


            This is what a typical installation has for entries that are already setup in /etc/rc.local along with new crony entries after them. The last two of my crony entries are custom scripts my machine has in /etc/cron.daily



            #!/bin/bash

            # NAME: crony
            # PATH: /usr/local/bin
            # DATE: July 17, 2019
            # NOTE: For Ask Ubuntu: https://askubuntu.com/questions/1159014/can-we-disable-cron-services-in-desktop

            logger "$0"

            sleep "$2"

            while true; do
            "$1"
            # If if parameter 2 is "d" for 1 day interval we can't sleep for a day
            # because laptop may have been suspended. Use 10 minutes to minimize resources
            sleep 10m
            # Check if time to process job again. If not continue
            continue

            done


            crony script needs more work but you get the general idea. This may or may not be a good project for WSL (Windows Subsystem for Linux) in which case I may finish it.







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Jul 18 at 0:35

























            answered Jul 17 at 17:19









            WinEunuuchs2UnixWinEunuuchs2Unix

            60.5k18 gold badges122 silver badges236 bronze badges




            60.5k18 gold badges122 silver badges236 bronze badges















            • Good news: In 18.04 and newer, Unattended Upgrades shifted from a cron job to a systemd timer. The cron job /etc/cron.daily/apt-compat is for folks who don't use systemd.

              – user535733
              Jul 17 at 17:31











            • logrotate could be a problem: log files not getting compressed. mlocate too. the command locate becomes useless.

              – Rinzwind
              Jul 17 at 17:42

















            • Good news: In 18.04 and newer, Unattended Upgrades shifted from a cron job to a systemd timer. The cron job /etc/cron.daily/apt-compat is for folks who don't use systemd.

              – user535733
              Jul 17 at 17:31











            • logrotate could be a problem: log files not getting compressed. mlocate too. the command locate becomes useless.

              – Rinzwind
              Jul 17 at 17:42
















            Good news: In 18.04 and newer, Unattended Upgrades shifted from a cron job to a systemd timer. The cron job /etc/cron.daily/apt-compat is for folks who don't use systemd.

            – user535733
            Jul 17 at 17:31





            Good news: In 18.04 and newer, Unattended Upgrades shifted from a cron job to a systemd timer. The cron job /etc/cron.daily/apt-compat is for folks who don't use systemd.

            – user535733
            Jul 17 at 17:31













            logrotate could be a problem: log files not getting compressed. mlocate too. the command locate becomes useless.

            – Rinzwind
            Jul 17 at 17:42





            logrotate could be a problem: log files not getting compressed. mlocate too. the command locate becomes useless.

            – Rinzwind
            Jul 17 at 17:42


















            draft saved

            draft discarded















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1159014%2fcan-we-disable-cron-services-in-desktop%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown









            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?