Tech Support > Microsoft Windows > Development Resources > Change security attributes of a folder
Change security attributes of a folder
Posted by Gernot Frisch on November 5th, 2007


Hi,

the function CreateDirectory allows to specify a SECURITY_ATTRIBUTE
thingy.
I want to do that for an existing directory.

My whole problem is, that my subfolder in CSIDL_COMMON_APPDATA must be
writable to everyone. So, what's the easiest way to do that?

--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}



Posted by Grzegorz Wróbel on November 5th, 2007


Gernot Frisch wrote:

The easiest way to solve your problem is to use CSIDL_APPDATA or
CSIDL_LOCAL_APPDATA and store settings independently for each user.

Otherwise it is most likely a design flaw. If the configuration settings
are to be set "per machine" then it should be done by administrators
only (and should request elevation for the configuration utility). If
the regular users are to modify the settings - each should change them
only for him/herself, not for every other user on the system.


--
Grzegorz Wróbel
http://www.4neurons.com/
677265676F727940346E6575726F6E732E636F6D

Posted by Gernot Frisch on November 6th, 2007



"Grzegorz Wróbel" </dev/null@localhost.localdomain> schrieb im
Newsbeitrag news:fgnl1b$ie0$1@atlantis.news.tpi.pl...
That's no option for me.
I have to store the license file path for a program to a computer. The
path should be editable from every user account, thus allowing every
user to change deprecated licensed without calling the admin.
Also, we have some shared files which we want each user to be able to
change. It's not a design flaw.

And my question was: How to make such an folder. Thus, I'd like allow
full access to everyone for the folder:
CSIDL_COMMON_APPDATA\OurCompany\shared

Can you please help?




Posted by Kevin English on November 6th, 2007


On Tue, 6 Nov 2007 09:58:49 +0100, "Gernot Frisch" <Me@Privacy.net>
wrote:

Assuming your application has some kind of install script that is run
by an administrator, you could have the script call cacls to modify
the DACL to your directory.

-
Kevin English

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Posted by Gernot Frisch on November 7th, 2007



"Kevin English" <kenglish@4csoftware.com> schrieb im Newsbeitrag
news:bt51j31g9a90j9q40gn4huc639jqc3tuhc@4ax.com...
I found no way to use cacls in a multilanguage environment. "Users" is
called "Benutzer" in Germany. Typing "User" won't help.



Posted by Tapio Luukkanen on November 7th, 2007



I had the same problem (user and group names localized in
Finnish and Swedish).

Google for an utility named "setacl.exe", it accepts SID-values in
their S-X-X-X-X form; here is a snippet from one post-install script:

------cut-----
rem Builtin "well-known" group SID-codes, see Microsoft kb243330

set SID_EVERYONE=S-1-1-0
set SID_LOCALSYSTEM=S-1-5-18

set SID_ADMINS=S-1-5-32-544
set SID_USERS=S-1-5-32-545
set SID_GUESTS=S-1-5-32-546
set SID_POWER_USERS=S-1-5-32-547

set IBNET_DIR=C:\ibnet

echo --------------------------------------------------
echo Setting correctory directory and Registry permissions...
echo --------------------------------------------------

echo Setting FULL rights for ADMINISTRATORS and USERS:
setacl -on %IBNET_DIR% -ot file -actn ace -ace "n:%SID_ADMINS%;p:full;s:y" -ace "n:%SID_USERS%;p:full;s:y"

------cut-----

Posted by Grzegorz Wróbel on November 8th, 2007


Gernot Frisch wrote:
There is %ALLUSERSPROFILE% variable that points to CSIDL_COMMON_APPDATA
(which is "C:\ProgramData\" on English Windows Vista by the way).

--
Grzegorz Wróbel
http://www.4neurons.com/
677265676F727940346E6575726F6E732E636F6D

Posted by Jerry Coffin on November 11th, 2007


In article <5pddgkFqrbpaU1@mid.individual.net>, Me@Privacy.net says...
The obvious way (for your task) would be to write a bit of C, C++, or
whatever to retrieve the name of the folder with SHGetSpecialFolderPath,
then spawn cacls, passing that path to it.

From one viewpoint, it would arguably be a bit cleaner to set the DACL
in your program instead, but quite frankly, I can't blame you for
avoiding that -- the whole API for dealing with ACLs is verbose, poorly
documented and generally a PITA.

--
Later,
Jerry.

The universe is a figment of its own imagination.

Posted by Gernot Frisch on November 12th, 2007




...which yields my problem:
If user1 writes a new file there, user2 may not change/delete it on
Vista!



Posted by Gernot Frisch on November 12th, 2007



That's _the_ solution. Thanks a lot!
It's pitty MS didn't include that tool in Windows.



Posted by Grzegorz Wróbel on November 12th, 2007


Gernot Frisch wrote:
My point was to use this variable with cacls.exe. Unless I misses something.

--
Grzegorz Wróbel
http://www.4neurons.com/
677265676F727940346E6575726F6E732E636F6D


Similar Posts