Solved

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

Posted on 2004-04-19
5
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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