Solved

Modifying folder permissions by command or batch file

Posted on 2008-11-02
10
959 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
[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
  • 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
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
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 …
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…

636 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