简体   繁体   中英

How to clear all permissions from a file using NSIS?

I'm building an installer, and I am trying to set a file to be executable only by administrators.

AccessControl::GrantOnFile \
"$INSTDIR/mercheckadmin.exe" "Administrators" "FullAccess"
Pop $0

I'm using that to grant permission, but I'm trying to figure out how to prevent regular users from opening the app. Thanks.

You can use ClearOnFile to give access to just one trustee but you might want to give full access to SYSTEM as well with GrantOnFile "c:\\path\\thefile" (SY) FullAccess after using ClearOnFile .

AccessControl::ClearOnFile "$INSTDIR\mercheckadmin.exe" "(BA)" "FullAccess"
Pop $0

The other alternative is to block access for specific trustees with DenyOnFile ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM