Solved

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

Posted on 2004-04-19
5
259 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 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

16 Experts available now in Live!

Get 1:1 Help Now