Hi experts,
I have a running WindowsXP with 3 users: Admin, User1 and User2. The Admin is administrator (you already guessed that).
Both users are restricted users.
Now I was under the impression that every file that User1 created could be changed/deleted by himself or by Admin. But User2 would have no chance to ever do something despite reading.
I tried that in some special folder "Dokumente und Einstellungen\All Users\Dokumente" (It's a german WinXP, english should be something like "Documents and Properties\All Users\Documents"). The result was as I had expected:
User1 creates a file, User2 can read it, Admin can do whatever he wants.
Now, on the second partition D:\ (NTFS, all of them) above rules don't seem to apply.
User1, again, creates a file and User2 can do whatever he wants, just like Admin.
Actually, the described behaviour (on D:\) is what I want to achieve: I am searching for a directory to serialize project files to. Everybody shall be allowed to open and change, no matter who created it.
I just can't be sure that on the target machine there will be a directory "D:\".
Is there, in WindowsXP, 2000, Vista, 7 a general rule what directories would behave like I saw happen in "D:\"?
Edit:
I seem to get what I want by creating a directory within "All Users\Documents\" and changing that directory's permissions. I did that manually by clicking and such.
To make this a programming question: How can I change the file I/O permissions for a folder to "Everyone may do everything with folder and all sub-folders and files"?
My first try was this one:
using System.Security;
using System.Security.Permissions;
private void PermitEverything(string filename)
{
NamedPermissionSet ps = new NamedPermissionSet(
"SamplePermissionSet",
PermissionState.None
);
ps.AddPermission(
new FileIOPermission(FileIOPermissionAccess.AllAccess, filename)
);
ps.AddPermission(
new SecurityPermission(SecurityPermissionFlag.Execution)
);
}
It doesn't work. Permissions stay as they were without even giving an error.
Edit2: I should have noted that this is about a .NET 2.0 WinForms application.