Solved

Modifying folder permissions by command or batch file

Posted on 2008-11-02
10
958 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
Don't Miss ATEN at InfoComm 2017!

Visit booth #2167 to see the  new ATEN VM3200 32 x 32 Modular Matrix Switch. Other highlights include the VE8950 4K HDMI Over IP Extender, VS1912 12-Port DP Video Wall Media Player  and VK2100 ATEN Control System. Register now with Free Pass Code ATEN288!

 
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

759 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