Well, this sounds like a pretty simple question. But I just cant seem to get the Permissions to work properly under windows (Win2k3 Server, WinXP, WinNT, etc), such that I can secure a LOG file from the user. I'm testing this on Win2k3 server at this time, but it actually needs to work on WinXP computers that are connected to a WinNT server (on a NT domain).
Basically, I have written a mess of calls to an audit function within my program that opens up a log file for append access. You know something like this (though I have tried a few other ways (TextStream etc
)):
Open FFN For Append As #1
Print #1, stEventLine
Close #1
Then during installation I log on as the administrator and create the log file (FFN). I then try to set the privileges under WinXP to allow the Users group to only have append privileges to that file. However, I get the strangest, unexplainable, weird, reaction to any changes to the privileges. When I set it for append only I still got an access error when trying to append to the log file.
Stranger still, when I set the Users to deny read access for some reason the Administrator also got read access denied. All sorts of other strange stuff happened, but that isnt important for this question. Im just interested in Append for now.
I also created a separate group and tried to set its privileges rather then using the Users group, but that had the same results. I also set the directory privileges as well as the files privileges but I still got the access error when trying to append (as a user).
I have also messed around with inheritance. Turning it on and turning it off. What seemed to work best was to set the folder permissions first and while doing that check the checkbox that says to Replace permissions on all child objects, and to also turn off inheritance. But nothing I do allows for append only. I always get an permission denied error when I try anything while logged in as a user.
Basically, I just need some advice on how to set up the privileges on a log file so that some set of users (either the Users group or some other group) has only append access (they can have read access as well, but not delete or writethis is to say that I want to allow users to append to the file but not change existing data or delete existing data). Also, I need to know how to write the code to append to that file (is it just a simple open for append like above)?