[SATLUG] Programming file permissions

Henry Pugsley henry.pugsley at gmail.com
Wed Apr 2 16:42:29 CDT 2008

On undefined, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:
> I am trying to write a program for both Linux and Windows.  I would like
>  to create a file that restricts read/write permissions to the owner.  In
>  linux/unix, this is trivial:
>  chmod( "/home/user/myfile.txt", 0600 );
>  Does anyone know how to do the equivalent thing in Windows.  I was able
>  to do what I wanted by right-click->properties->security->advanced
>  unselect "Inherit from parent permission entities..."
>  And then select unwanted groups like Everyone and "Remove".
>  I want to do that within a C++ program.  Does anyone have any idea how
>  to do this?
>  BTW, did I say before that Windows is a PITA?
>    -- Bruce

 I don't know about C++, but there is a VB program called xcacls.vbs
that may have some useful sample code in it for changing permissions
and ownership on NTFS.  Might be easier to use C# though.


"The best way to predict the future is to invent it" - Alan Kay

More information about the SATLUG mailing list