file-security

set file permissions for c:\program files\company\app\file for all users

我只是一个虾纸丫 提交于 2020-01-21 15:18:51
问题 I've a custom installer program that has worked fine, but it asks the user for admin permission every time it updates an application. I'm creating a windows service that skips this part, but the windows service gives only System and Administrators permissions to the file, and the user cannot execute the new updates. To correct this I'm trying (after the file downloads/installs to the correct place (from within the windows service, it has the account ServiceAccount.LocalSystem), FileSecurity

take ownership of a file c#

廉价感情. 提交于 2020-01-13 09:04:16
问题 I am trying to take ownership of a file and delete it via C#. The file is iexplorer.exe, current owner by default - TrustedInstaller. The method FileSecurity.SetOwner seems to set the specified ownership, but actually doesn't change the initial owner and throws no exception. Obviously, the next attempt to delete the file throws an exception. What should be changed in the code to take ownership of the file and delete it ? var fileS = File.GetAccessControl(@"C:\Program Files (x86)\Internet

take ownership of a file c#

久未见 提交于 2020-01-13 09:03:47
问题 I am trying to take ownership of a file and delete it via C#. The file is iexplorer.exe, current owner by default - TrustedInstaller. The method FileSecurity.SetOwner seems to set the specified ownership, but actually doesn't change the initial owner and throws no exception. Obviously, the next attempt to delete the file throws an exception. What should be changed in the code to take ownership of the file and delete it ? var fileS = File.GetAccessControl(@"C:\Program Files (x86)\Internet

Setting ACE slow for folder with many files

巧了我就是萌 提交于 2019-12-23 03:22:43
问题 we have created an application which provides the ability to set a recursive "Deny" on a windows folder for a certain Active Directory group. Basically the same as going into the properties dialog in windows explorer and clicking on security and the adding an AD group with the permission of Deny. We are using this code: public void DenyAccessInherited(string DomainAndSamAccountName) { SetPermissionAndInherit(this.FolderPath, NTFSPermission.PropagationFlags.CONTAINER_AND_OBJECT_INHERIT_ACE,

ERROR_ACCESS_DENIED setting file owner

流过昼夜 提交于 2019-12-13 00:40:53
问题 I am trying to set the owner of a file to another user programmatically in C++. I have definitely enabled the SeRestorePrivilege for my process. I can confirm this using Process Explorer. I start the process, it is disabled, I run my code to enable it, ProcExp reports it as enabled, I go just up to the point where the owner is to be set, and it is still enabled (i.e. I am not accidentally disabling it). What other caused can there be for this access is denied message? What have I not

Securing Files over Web: Fine Grained Authorization Based File Access

旧街凉风 提交于 2019-12-07 23:48:52
问题 I have a system where employees can upload files. There are three ways Upload to my account in public, private or protected mode Upload to department account in public, private or protected mode Upload to organization account in public, private or protected mode where public is visible to anyone, private to the group or person only and protected to anyone in the organization. All the files for an organization are stored in a directory say, /files/<organizationId>/, on file server like files +

Setting ACE slow for folder with many files

跟風遠走 提交于 2019-12-07 03:59:25
we have created an application which provides the ability to set a recursive "Deny" on a windows folder for a certain Active Directory group. Basically the same as going into the properties dialog in windows explorer and clicking on security and the adding an AD group with the permission of Deny. We are using this code: public void DenyAccessInherited(string DomainAndSamAccountName) { SetPermissionAndInherit(this.FolderPath, NTFSPermission.PropagationFlags.CONTAINER_AND_OBJECT_INHERIT_ACE, NTFSPermission.NTFSPermission_FULL_CONTROL, NTFSPermission.ACETypes.ADS_ACETYPE_ACCESS_DENIED,

Securing Files over Web: Fine Grained Authorization Based File Access

折月煮酒 提交于 2019-12-06 06:23:53
I have a system where employees can upload files. There are three ways Upload to my account in public, private or protected mode Upload to department account in public, private or protected mode Upload to organization account in public, private or protected mode where public is visible to anyone, private to the group or person only and protected to anyone in the organization. All the files for an organization are stored in a directory say, /files/<organizationId>/, on file server like files +-- 234809 | +img1.jpg | +doc1.pdf +-- 808234 | +doc2.pdf I am storing file-path and privacy level in DB

File sharing not working as expected

我与影子孤独终老i 提交于 2019-12-03 17:13:10
问题 I have a file sharing issue where my process is trying to read a log file whilst it is currently still open by NLog. In diagnosing the issue, I found something surprising. The following fails: using (var fileStream1 = new FileStream("test.file", FileMode.Append, FileAccess.Write, FileShare.Read)) using (var fileStream2 = new FileStream("test.file", FileMode.Open, FileAccess.Read, FileShare.Read)) { } The second FileStream constructor call fails with: System.IO.IOException was unhandled

File sharing not working as expected

Deadly 提交于 2019-12-03 05:31:54
I have a file sharing issue where my process is trying to read a log file whilst it is currently still open by NLog. In diagnosing the issue, I found something surprising. The following fails: using (var fileStream1 = new FileStream("test.file", FileMode.Append, FileAccess.Write, FileShare.Read)) using (var fileStream2 = new FileStream("test.file", FileMode.Open, FileAccess.Read, FileShare.Read)) { } The second FileStream constructor call fails with: System.IO.IOException was unhandled Message=The process cannot access the file 'c:\...\test.file' because it is being used by another process.