troubleshooting Question

Setting default permissions in folder

Avatar of BlearyEye
BlearyEyeFlag for United States of America asked on
C#.NET Programming
12 Comments2 Solutions345 ViewsLast Modified:
I'm using C# 4.0. I have a folder "C:\Users\leal\AppData\Roaming\MyApp". The permissions on this folder let Everyone have full access to it. My program creates a file "MyDB.bak" in that folder. When I try to run a restore from SQL Server, I get the error

Cannot open backup device 'C:\Users\leal\AppData\Roaming\Myapp\MyDB.bak'. Operating system error 5(Access is denied.).

The problem is that Everyone does not have access to this file. I know I could explicitly give permissions to MyDB.bak, but I'd prefer to set it up so that files created in the folder inherit the folder's security attributes. Can I do this?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros