Are there a way to block a program from starting during certain times?












1















I want to prevent a certain program from being started during specific times. Are there a good way of accomplishing this at *nix distros?










share|improve this question

























  • My only idea is to create cron jobs that make chmod -x at the beggining and +x at the end of your time period.

    – pbm
    Sep 26 '11 at 17:50











  • It depends what you need to prevent from starting it.

    – David Schwartz
    Sep 26 '11 at 17:59











  • I want to prevent a logged in user at an Ubuntu workstation from starting certain programmes

    – Industrial
    Sep 26 '11 at 18:46






  • 1





    What do you expect to happen if the user obtains a copy of the executable and tries to run it? What if the user gets the source code and compiles the program?

    – Gilles
    Sep 27 '11 at 0:47











  • No idea, but I know that it won't be Linus Torvalds who will be using the computer of which I need to apply this blocking at, so I am pretty sure that no compiling will occur

    – Industrial
    Sep 27 '11 at 10:06


















1















I want to prevent a certain program from being started during specific times. Are there a good way of accomplishing this at *nix distros?










share|improve this question

























  • My only idea is to create cron jobs that make chmod -x at the beggining and +x at the end of your time period.

    – pbm
    Sep 26 '11 at 17:50











  • It depends what you need to prevent from starting it.

    – David Schwartz
    Sep 26 '11 at 17:59











  • I want to prevent a logged in user at an Ubuntu workstation from starting certain programmes

    – Industrial
    Sep 26 '11 at 18:46






  • 1





    What do you expect to happen if the user obtains a copy of the executable and tries to run it? What if the user gets the source code and compiles the program?

    – Gilles
    Sep 27 '11 at 0:47











  • No idea, but I know that it won't be Linus Torvalds who will be using the computer of which I need to apply this blocking at, so I am pretty sure that no compiling will occur

    – Industrial
    Sep 27 '11 at 10:06
















1












1








1


1






I want to prevent a certain program from being started during specific times. Are there a good way of accomplishing this at *nix distros?










share|improve this question
















I want to prevent a certain program from being started during specific times. Are there a good way of accomplishing this at *nix distros?







ubuntu gnome






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 10 at 19:02









Rui F Ribeiro

40.5k1479137




40.5k1479137










asked Sep 26 '11 at 17:18









IndustrialIndustrial

5812712




5812712













  • My only idea is to create cron jobs that make chmod -x at the beggining and +x at the end of your time period.

    – pbm
    Sep 26 '11 at 17:50











  • It depends what you need to prevent from starting it.

    – David Schwartz
    Sep 26 '11 at 17:59











  • I want to prevent a logged in user at an Ubuntu workstation from starting certain programmes

    – Industrial
    Sep 26 '11 at 18:46






  • 1





    What do you expect to happen if the user obtains a copy of the executable and tries to run it? What if the user gets the source code and compiles the program?

    – Gilles
    Sep 27 '11 at 0:47











  • No idea, but I know that it won't be Linus Torvalds who will be using the computer of which I need to apply this blocking at, so I am pretty sure that no compiling will occur

    – Industrial
    Sep 27 '11 at 10:06





















  • My only idea is to create cron jobs that make chmod -x at the beggining and +x at the end of your time period.

    – pbm
    Sep 26 '11 at 17:50











  • It depends what you need to prevent from starting it.

    – David Schwartz
    Sep 26 '11 at 17:59











  • I want to prevent a logged in user at an Ubuntu workstation from starting certain programmes

    – Industrial
    Sep 26 '11 at 18:46






  • 1





    What do you expect to happen if the user obtains a copy of the executable and tries to run it? What if the user gets the source code and compiles the program?

    – Gilles
    Sep 27 '11 at 0:47











  • No idea, but I know that it won't be Linus Torvalds who will be using the computer of which I need to apply this blocking at, so I am pretty sure that no compiling will occur

    – Industrial
    Sep 27 '11 at 10:06



















My only idea is to create cron jobs that make chmod -x at the beggining and +x at the end of your time period.

– pbm
Sep 26 '11 at 17:50





My only idea is to create cron jobs that make chmod -x at the beggining and +x at the end of your time period.

– pbm
Sep 26 '11 at 17:50













It depends what you need to prevent from starting it.

– David Schwartz
Sep 26 '11 at 17:59





It depends what you need to prevent from starting it.

– David Schwartz
Sep 26 '11 at 17:59













I want to prevent a logged in user at an Ubuntu workstation from starting certain programmes

– Industrial
Sep 26 '11 at 18:46





I want to prevent a logged in user at an Ubuntu workstation from starting certain programmes

– Industrial
Sep 26 '11 at 18:46




1




1





What do you expect to happen if the user obtains a copy of the executable and tries to run it? What if the user gets the source code and compiles the program?

– Gilles
Sep 27 '11 at 0:47





What do you expect to happen if the user obtains a copy of the executable and tries to run it? What if the user gets the source code and compiles the program?

– Gilles
Sep 27 '11 at 0:47













No idea, but I know that it won't be Linus Torvalds who will be using the computer of which I need to apply this blocking at, so I am pretty sure that no compiling will occur

– Industrial
Sep 27 '11 at 10:06







No idea, but I know that it won't be Linus Torvalds who will be using the computer of which I need to apply this blocking at, so I am pretty sure that no compiling will occur

– Industrial
Sep 27 '11 at 10:06












2 Answers
2






active

oldest

votes


















1














Have crontab rigged to create or remove a file in /var/lock/, and have the program test for the existence of that file. If the file exists, refuse to run.



Note that this will not keep a determined and intelligent user from simply copying over the program and altering it to ignore the test -- but then again, using a cron-scheduled chmod -x/+x won't deter smart users either...






share|improve this answer































    0














    A cron job to chmod the files to add/remove the execute permission could do this (as pbm's comment suggests).



    Alternatively you could put all these apps (assuming its a small set of well-defined apps) in one directory, and then rename (or remove permissions on the directory) in a cron job.



    Alternatively, you could setup SELinux (or other Linux security solutions?) to whitelist/blacklist applications. I didn't see anything that easily accomplishes from some quick googling, though.






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      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: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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/3.0/"u003ecc by-sa 3.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%2funix.stackexchange.com%2fquestions%2f21451%2fare-there-a-way-to-block-a-program-from-starting-during-certain-times%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









      1














      Have crontab rigged to create or remove a file in /var/lock/, and have the program test for the existence of that file. If the file exists, refuse to run.



      Note that this will not keep a determined and intelligent user from simply copying over the program and altering it to ignore the test -- but then again, using a cron-scheduled chmod -x/+x won't deter smart users either...






      share|improve this answer




























        1














        Have crontab rigged to create or remove a file in /var/lock/, and have the program test for the existence of that file. If the file exists, refuse to run.



        Note that this will not keep a determined and intelligent user from simply copying over the program and altering it to ignore the test -- but then again, using a cron-scheduled chmod -x/+x won't deter smart users either...






        share|improve this answer


























          1












          1








          1







          Have crontab rigged to create or remove a file in /var/lock/, and have the program test for the existence of that file. If the file exists, refuse to run.



          Note that this will not keep a determined and intelligent user from simply copying over the program and altering it to ignore the test -- but then again, using a cron-scheduled chmod -x/+x won't deter smart users either...






          share|improve this answer













          Have crontab rigged to create or remove a file in /var/lock/, and have the program test for the existence of that file. If the file exists, refuse to run.



          Note that this will not keep a determined and intelligent user from simply copying over the program and altering it to ignore the test -- but then again, using a cron-scheduled chmod -x/+x won't deter smart users either...







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 26 '11 at 19:11









          ShadurShadur

          19.8k74557




          19.8k74557

























              0














              A cron job to chmod the files to add/remove the execute permission could do this (as pbm's comment suggests).



              Alternatively you could put all these apps (assuming its a small set of well-defined apps) in one directory, and then rename (or remove permissions on the directory) in a cron job.



              Alternatively, you could setup SELinux (or other Linux security solutions?) to whitelist/blacklist applications. I didn't see anything that easily accomplishes from some quick googling, though.






              share|improve this answer




























                0














                A cron job to chmod the files to add/remove the execute permission could do this (as pbm's comment suggests).



                Alternatively you could put all these apps (assuming its a small set of well-defined apps) in one directory, and then rename (or remove permissions on the directory) in a cron job.



                Alternatively, you could setup SELinux (or other Linux security solutions?) to whitelist/blacklist applications. I didn't see anything that easily accomplishes from some quick googling, though.






                share|improve this answer


























                  0












                  0








                  0







                  A cron job to chmod the files to add/remove the execute permission could do this (as pbm's comment suggests).



                  Alternatively you could put all these apps (assuming its a small set of well-defined apps) in one directory, and then rename (or remove permissions on the directory) in a cron job.



                  Alternatively, you could setup SELinux (or other Linux security solutions?) to whitelist/blacklist applications. I didn't see anything that easily accomplishes from some quick googling, though.






                  share|improve this answer













                  A cron job to chmod the files to add/remove the execute permission could do this (as pbm's comment suggests).



                  Alternatively you could put all these apps (assuming its a small set of well-defined apps) in one directory, and then rename (or remove permissions on the directory) in a cron job.



                  Alternatively, you could setup SELinux (or other Linux security solutions?) to whitelist/blacklist applications. I didn't see anything that easily accomplishes from some quick googling, though.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 26 '11 at 19:15









                  P.T.P.T.

                  1,2881910




                  1,2881910






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • 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%2funix.stackexchange.com%2fquestions%2f21451%2fare-there-a-way-to-block-a-program-from-starting-during-certain-times%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

                      How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                      is 'sed' thread safe

                      How to make a Squid Proxy server?