Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

As the title says. 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
add comment

2 Answers

up vote 1 down vote accepted

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.