Solved

Changing security settings of a file via a scheduled task or service

Posted on 2004-04-19
5
258 Views
Last Modified: 2010-04-19
We have a programme running on Windows 2003 Server as a service.  It creates a log file, and everytime it writes to the log file it changes the security settings so only Administrator has rights to view the file.  Even if I manually reset the security settings on the file, when it next writes back to it, it resets the security back to Admin only.

I would like to run some sort of a programme that is scheduled to run a few minutes afterwards, that resets the security on the log file so that standard users can view the log file.

Does anyone know of any software that can do this??  

0
Comment
Question by:notable
  • 3
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
JamesDS earned 500 total points
ID: 10866162
notable
You can use the CACLS command that comes with windows in a script:

CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
               [/P user:perm [...]] [/D user [...]]
   filename      Displays ACLs.
   /T            Changes ACLs of specified files in
                 the current directory and all subdirectories.
   /E            Edit ACL instead of replacing it.
   /C            Continue on access denied errors.
   /G user:perm  Grant specified user access rights.
                 Perm can be: R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /R user       Revoke specified user's access rights (only valid with /E).
   /P user:perm  Replace specified user's access rights.
                 Perm can be: N  None
                              R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /D user       Deny specified user access.
Wildcards can be used to specify more that one file in a command.
You can specify more than one user in a command.

Or you can use the XCACLS.EXE command that comes with the resource kit available at www.microsoft.com/reskit

Cheers

JamesDS
0
 

Author Comment

by:notable
ID: 10866605
CACLS does change the user rights correctly, but requires a user input (Y/N) when running.  I need to be able to schedule this to be run without user input.

Normally I just add a "<y.txt" at the end of the command line, and create a y.txt file with Y in it to automatically respond Y to this sort of question.  Doesn't seem to work in this instance.

XCACLS.EXE is not part of the 2003 resource kit.   Any other ideas where to find it, as it may not require the input that CACLS does.

Thanks.
0
 
LVL 16

Expert Comment

by:JamesDS
ID: 10866641
notable

doh!

XCACLS.EXE is part of the Windows 2003 support tools on the CD

Sorry for the confusion

Cheers

JamesDS

0
 

Author Comment

by:notable
ID: 10883342
Thanks.  XCACLS works great - it has an option for the /Y switch to force an answer of Yes.

Regards,
Russell.
0
 
LVL 16

Expert Comment

by:JamesDS
ID: 10886283
notable
Welcome, glad it works for you

Cheers

JamesDS
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now