Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

darth barf

macrumors newbie
Original poster
Aug 12, 2011
1
0
Hi forum,

new to this forum, although I've browsed it a while. I'm Dutch, use Macbook Pro, Time Capsule and iPhone 4 and generally love most things Apple.

I've been looking for software that will allow me to put a time lock on specific folders to make sure that a specific folder can't be opened for, say, a week, month or year. Any way to do that?

All advice, other that the obvious 'why would you want to', would be much appreciated:)

Thanks, Paul
 
Hi forum,

new to this forum, although I've browsed it a while. I'm Dutch, use Macbook Pro, Time Capsule and iPhone 4 and generally love most things Apple.

I've been looking for software that will allow me to put a time lock on specific folders to make sure that a specific folder can't be opened for, say, a week, month or year. Any way to do that?

All advice, other that the obvious 'why would you want to', would be much appreciated:)

Thanks, Paul
First, let's get the requirements out of the way...
What version of Mac OS X are you running? You can find out by going to the Apple menu and choosing About This Mac...
Do you have a PowerPC or Intel CPU? (About This Mac will tell you this too.)
Are you comfortable at the command line, or is a graphical user interface what you need?

Knowing these things will whittle down the field of candidate applications.
 
Hi forum,

new to this forum, although I've browsed it a while. I'm Dutch, use Macbook Pro, Time Capsule and iPhone 4 and generally love most things Apple.

I've been looking for software that will allow me to put a time lock on specific folders to make sure that a specific folder can't be opened for, say, a week, month or year. Any way to do that?

All advice, other that the obvious 'why would you want to', would be much appreciated:)

Thanks, Paul

I can think of one way in terminal that you (or any admin) on your Mac could easily get around...
Start terminal and change to the parent folder of the folder (named lockme in this example) you want to "lock"...
chmod 000 lockme

This takes away all permissions on the folder in question. Not to worry, the permissions are stored in the parent folder so you can put them back and here's the rub. Any person who owns the parent folder can put them back. Anyway, here's the second part

create a file in textedit called ~/allow.sh and enter the following (sorry my unix is showing, ~ means your home folder)...

#!/bin/bash
chmod 744 /whereveritis/lockme


When you are done, you will also need to grant yourself execute permission on the file you just made...
chmod 700 allow.sh

I'm assuming you don't want the "other user" to do this, hence 700 so they can't even read the contents of allow.sh

now run
sudo crontab -e
add an entry for the date you want the restrictions to expire to run allow.sh

Code:
*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

This puts you in VI (or some other editor I'll check when I'm in front of my Mac). Assuming you are in VI, you can now hit i to insert a new line...

After hitting "i" for insert, you will type the following...
0 8 13 9 * /Users/myaccount/allow.sh

Sorry, the ~ shortcut doesn't work in crontab. You have to spell out the complete path to the task you want to run.

After inserting the new line you hit escape which puts you in command mode and you can type :wq! to force write and exit from crontab.

This causes allow.sh to run at 8am on september 13th on whatever day of the week that happens to be. It will run every year until you run crontab -e and delete the line you just entered.

All done. But if the person you don't want peeking in that file is an admin they could sudo to put everything back and see their birthday present ;) (my crude guess at why you are doing this).
 
I can think of one way in terminal that you (or any admin) on your Mac could easily get around...
Start terminal and change to the parent folder of the folder (named lockme in this example) you want to "lock"...
chmod 000 lockme

This takes away all permissions on the folder in question. Not to worry, the permissions are stored in the parent folder so you can put them back and here's the rub. Any person who owns the parent folder can put them back. Anyway, here's the second part

create a file in textedit called ~/allow.sh and enter the following (sorry my unix is showing, ~ means your home folder)...

#!/bin/bash
chmod 744 /whereveritis/lockme


When you are done, you will also need to grant yourself execute permission on the file you just made...
chmod 700 allow.sh

I'm assuming you don't want the "other user" to do this, hence 700 so they can't even read the contents of allow.sh

now run
sudo crontab -e
add an entry for the date you want the restrictions to expire to run allow.sh

Code:
*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

This puts you in VI (or some other editor I'll check when I'm in front of my Mac). Assuming you are in VI, you can now hit i to insert a new line...

After hitting "i" for insert, you will type the following...
0 8 13 9 * /Users/myaccount/allow.sh

Sorry, the ~ shortcut doesn't work in crontab. You have to spell out the complete path to the task you want to run.

After inserting the new line you hit escape which puts you in command mode and you can type :wq! to force write and exit from crontab.

This causes allow.sh to run at 8am on september 13th on whatever day of the week that happens to be. It will run every year until you run crontab -e and delete the line you just entered.

All done. But if the person you don't want peeking in that file is an admin they could sudo to put everything back and see their birthday present ;) (my crude guess at why you are doing this).


Your good! Now how do i setup something in terminal so i can move or delete files from multiple folders at specified intervals. Like i have these scratch folders and they get full. I want to just wipe them out every day automatically. Can you help me, pretty please?

TIA.

Jesse
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.