Solved

Modifying folder permissions by command or batch file

Posted on 2008-11-02
10
955 Views
Last Modified: 2012-05-05
I have several computers where the users are not administrators. I recently found out that in order to user a new product these users need to have modify access to 3 folders on the local C drive of their machine. I have ghost solution suite so I have the ability to run batch files remotely on their machines.

I think the easiest way to accomplish what I need to do is just grant the Everyone group modify access to these folders. Is this possible using the command line or a batch file.

Lets assume the folder we need to modify permissions on  is c:\myprogram.
0
Comment
Question by:Joseph Daly
  • 5
  • 4
10 Comments
 
LVL 2

Accepted Solution

by:
m3tech earned 500 total points
ID: 22864140
There are cleaner ways to do this in a domain, but since you didn't mention one, try the following command:

cacls c:\myprogram\*.* /t /e /g everyone:F

This command will change the permissions to all files in c:\myprogram and all subdirectories and files (/t argument), editing permisions instead of replacing (/e argument) and granting (/g argument) everyone full control.

Please test this before applying. Type cacls alone in a cmd prompt for more info.
0
 
LVL 77

Expert Comment

by:Rob Williams
ID: 22864144
You can use xacls.exe within a batch file to modify NTFS permissions if this helps you, but but for the recod it doesn't affect share permissions.
http://support.microsoft.com/kb/318754
0
 
LVL 2

Expert Comment

by:m3tech
ID: 22864148
I just re-read your post use "everyone:C" to grant "change" permissions instead of full control.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 2

Expert Comment

by:m3tech
ID: 22864153
Please note that xCacls.exe is a Windows 2000 version of cacls.exe that must be downloaded. cacls.exe is installed with windows and should always be available.
0
 
LVL 35

Author Comment

by:Joseph Daly
ID: 22864168
M3tech: I just took a look at the /? for CACLS.exe and it looks like what you gave me up there will work. Im gonna wait until tomorrow morning when I get into work to test it but if it works the points are all yours.

Thanks
0
 
LVL 2

Expert Comment

by:m3tech
ID: 22864187
No hurry, let me know if there are any problems. Incidentally, this same command will let you take permissions/ownership of ntfs drives/folders in XP home without requiring a reboot into safe mode (my primary use for it :p)
0
 
LVL 35

Author Comment

by:Joseph Daly
ID: 22867027
Ok so I just tried this this morning and I ran into some problems here is what I did.

1. Created a new folder on my local C drive called test.
2. The folder looks like it inherited the default permissions
3. I ran the command "cacls c:\test\*.* /t /e /g users:F"
4. Checked the folder permissions and they did not change.

The batch file looks like it complete successfully and didnt return any errors however the security did not change. I have attached a screenshot of the folder permissions below. Now it looks like it changed the permissions on the files within the folder but I also need the ability to change it on the folder itself.
1.jpg
0
 
LVL 35

Author Comment

by:Joseph Daly
ID: 22867240
Actually I think I might have it. I changed the CACLS command to.

"c:\test /t /e /g users:F" and it looks like it did it.
0
 
LVL 35

Author Closing Comment

by:Joseph Daly
ID: 31512566
Awesome answer. Exactly what I needed.
0
 
LVL 2

Expert Comment

by:m3tech
ID: 22873781
I'd have to play with the commands myself, although I see where your problem came into play with the example I gave and it looks like that your code may fix the issue.

If you find it doesn't, you could always add another calcs.exe command to your batch file and process the folder and files/subdirectories seperately. Not clean, but eh.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

813 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

12 Experts available now in Live!

Get 1:1 Help Now