Temporary deny use of windows share

1

I would like to know if it is possible to temporary deny access to windows share folders for a specific user at a specific time range?

Example: Deny access to user User1 for folder WolfyShare from 23:00 to 12:00 or Allow access to user User1 for folder WolfyShare from 12:00 to 23:00

If it is possible, can you tell me how to do this?

Wolfy

Posted 2013-03-05T14:04:21.573

Reputation: 236

Answers

3

There is no built-in utility to do this, but you could accomplish it with a scheduled revoke of the user's permissions and then a scheduled change to put the permissions back.

In Task Scheduler, you would create a basic task of cacls filename /r WolfyShare at 23:00. This revokes all access permissions of the user.

Then to restore access, you would reverse the change with cacls filename /g WolfyShare:f at 12:00.

You would create similar tasks for the other user at the corresponding times.

To disconnet a user's session, you could use net session \\computername /delete, however this method would require the user always be using the same PC.

Read about cacls.exe on Technet. Read about how to disconnect a user using net session.

Moses

Posted 2013-03-05T14:04:21.573

Reputation: 10 813

Thanks for this! I did it as you tell me (with Icacls), but in case that this user is already using a file (like video clip,...) this will not stop the use of this file... any ideas why? I also disabled cache (/cache:none) – Wolfy – 2013-03-06T13:29:48.483

I updated my answer – Moses – 2013-03-07T20:02:12.260