Avatar of Olevo
OlevoFlag for Australia

asked on 

How to change NTFS permission to the folder based on the time of the day?

Active Directory group ‘Help Desk’ will have ‘Read & execute’ permission to the ‘Support’ folder between 7 am – 5 pm. All other time access to the ‘Support’ folder for 'Help Desk' AD group must be denied.
 
I’m guessing that I need to create two batch files which will be running on the Windows 2008 R2 file server. One is to enable NTFS permission on a folder, and second one is to disable NTFS permission. First batch file I will run as a scheduler task at 7 am (to enable permission) and second batch file will be running as a scheduler task at 5 pm (to disable permission)

I need some help with creating these permission controlling batch files. If the batch file failed to run successfully I need to know about it.

Thanks in advance.
PowershellScripting LanguagesWindows Batch

Avatar of undefined
Last Comment
Steve Knight
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Just quick look here at the mo., that sounds potentially all sorts of issues with permissons given to folders below helpdesk being removed etc?

Also would a possible way may be to make sure the folder is only accessible via its own share and adjust the share permissions, or even remove the share at different times of day?

Can help with scripts later if no-one else has.

Steve
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

I'd remove/add the group that gives rights from the Helpdesk group instead of changing ntfs rights.
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

That was the other way I was thinking too, if you remove the users from the groups of course it will not work because the user would still have access to that group's data until they logged off.

So thinking this through.... assuming it is part of an existing shared drive and can't be it's own share to simplify things then:

User A = member of users_Helpdesk group
Helpdesk directory has permissions at NTFS level for permissions_Helpdesk group
users_Helpdesk group is in permissions_Helpdesk group...

So does that work if you remove the group?

Also another way maybe would be to add / remove a "Deny" for the Helpdesk group to NTFS, or the share permissions.

Olevo - can you clarify if share methods is feasible?

Steve
Avatar of Olevo
Olevo
Flag of Australia image

ASKER

Help Desk group just an example here. Since I don’t know how to block users (DirectAccess) from accessing some of the company resources remotely, I thought that simple NTFS permission will do the trick for me. Basically, we don’t want our users to have remote access to few network folders after 5 pm!

I am thinking of using iCACLS.exe (or similar utility) in my batch file for changing folder permission. However, I am a bit stack with the syntax of the command.
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Switch the server off :-)
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Sorry... are these just select folders within mapped drives / UNC / DFS shares that they need access to other folders still at any time?

Steve
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Olevo
Olevo
Flag of Australia image

ASKER

Thanks Steve, after running command:

icacls x:\Helpdesk /deny domain\HelpdeskGroup:f /c /t

Permission applied to files but not folders (failed processing) within 'Helpdesk' folder. And, 'HelpDesk' group still have access to 'HelpDesk' folder?!

Since denying or granting permission takes time to propagate down the ACL chain, doing this two times a day for a folder with thousands of files and folders might be not so good idea to do... And, what about if the user/s belongs to multiple groups and this groups have different permission on a 'HelpDesk' folder. However I think, explicit deny will win anyway...

Maybe simply changing name of the folder or share is far better and simpler solution in my case? What do you think?
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

deny will always lose over another group so a specific deny to Helpdesk.

If it can be mapped only via a specific share then all you have to do is either stop the share at specific times of day and re-add it, or add/remove the share permissions to deny.  Other non-helpdesk users could get to it from a different share.

e.g.  ShareA = All users who need it.  Put "deny" for Helpdesk users group, map 'normal' users here who need it
ShareB = Added  and removed...

net share HelpdeskShare=x:\data\helpdesk /grant:Helpdeskgroup,read
net share HelpdeskShare /delete

Would mean maybe moving the folder to a different area if currently on a general shared area so that they can only get to it that route though.

If that is an option the share permissions apart from adding like above can be done from VBScript or powershell afaik.

Steve
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Did you get anywhere with this, need any more help?
Scripting Languages
Scripting Languages

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.

30K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo