[SATLUG] Programming file permissions
Ernest De Leon
edeleonjr at gmail.com
Wed Apr 2 16:52:53 CDT 2008
you will need to have the C++ proggy call the shell (CMD) and run a cacls
command (just google cacls) you should be able to do what you want through
there. My only advice is to be mindful of how win acls lay down vs posix
ones. One of the biggest headaches storage vendors run into when trying to
emulate windows server shares that run on top of linux file systems is the
posix to winacl mappings.
On Wed, Apr 2, 2008 at 2:42 PM, Henry Pugsley <henry.pugsley at gmail.com>
> 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.
> > 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
> SATLUG mailing list
> SATLUG at satlug.org
> http://alamo.satlug.org/mailman/listinfo/satlug to unsubscribe
> Powered by Rackspace (www.rackspace.com)
Ernest de Leon
"They who can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - A common 18th Century sentiment
voiced by Benjamin Franklin
"A patriot must always be ready to defend his country against his
government." - Edward Abbey
"All that is necessary for evil to triumph is for good men to do nothing." -
Edmund Burke, English statesman and political philosopher (1729-1797)
More information about the SATLUG